Click here to Skip to main content
16,008,010 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: The Useful DLL Pin
leppie12-Mar-08 6:13
leppie12-Mar-08 6:13 
GeneralRe: The Useful DLL Pin
Pete O'Hanlon12-Mar-08 13:02
mvePete O'Hanlon12-Mar-08 13:02 
GeneralRe: The Useful DLL Pin
leppie12-Mar-08 6:09
leppie12-Mar-08 6:09 
GeneralRe: The Useful DLL Pin
Pete O'Hanlon12-Mar-08 12:38
mvePete O'Hanlon12-Mar-08 12:38 
GeneralRe: The Useful DLL Pin
leppie12-Mar-08 19:44
leppie12-Mar-08 19:44 
GeneralRe: The Useful DLL Pin
Pete O'Hanlon12-Mar-08 22:53
mvePete O'Hanlon12-Mar-08 22:53 
GeneralRe: The Useful DLL Pin
VentsyV14-Mar-08 8:36
VentsyV14-Mar-08 8:36 
GeneralRe: The Useful DLL Pin
leppie14-Mar-08 9:29
leppie14-Mar-08 9:29 
VentsyV wrote:
There is no way you can create any instance of this class, as it is in assembly by itself.


First off, if this class in an assembly by itself and the assembly does not have any friend assemblies, the rest that follow is irrelevant. Then it means he uses reflection for something stupid.

You need to understand that you dont need to create an instance.

Lets take a 'real world' example (this is in xacc.ide, not sure how real world it is Poke tongue | ;-P ):
public sealed class TextBuffer
{
  internal TextBuffer(AdvancedTextBox atb) { ... }
}

public class AdvancedTextBox
{
  public TextBuffer Buffer {get {return buffer;}}
  public AdvancedTextBox()
  {
    buffer = new TextBuffer(this);
  }
}

Now I dont want anyone to use the TextBuffer class without using my AdvancedTextBox class. In other words, the author states the class is not usable without accessing it thought an AdvancedTextBox instance, for whatever reason that may be (perhaps unstable, restricted, propriety, etc).

Note: the example is not exactly like it is in xacc.ide, I rather use the better approach of making TextBuffer a nested class of AdvancedTextBox, thus giving me even more flexibility on usage. Wink | ;)

xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 2 out now

GeneralRe: The Useful DLL Pin
PIEBALDconsult16-Mar-08 5:53
mvePIEBALDconsult16-Mar-08 5:53 
GeneralRe: The Useful DLL Pin
leppie16-Mar-08 6:07
leppie16-Mar-08 6:07 
GeneralRe: The Useful DLL Pin
PIEBALDconsult16-Mar-08 7:25
mvePIEBALDconsult16-Mar-08 7:25 
GeneralRe: The Useful DLL Pin
VentsyV19-Mar-08 11:05
VentsyV19-Mar-08 11:05 
GeneralAudible Horror Pin
Philip Laureano8-Mar-08 11:10
Philip Laureano8-Mar-08 11:10 
GeneralRe: Audible Horror Pin
Colin Angus Mackay8-Mar-08 12:36
Colin Angus Mackay8-Mar-08 12:36 
GeneralRe: Audible Horror Pin
Nemanja Trifunovic8-Mar-08 16:49
Nemanja Trifunovic8-Mar-08 16:49 
GeneralRe: Audible Horror Pin
Philip Laureano9-Mar-08 0:20
Philip Laureano9-Mar-08 0:20 
GeneralRe: Audible Horror Pin
Colin Angus Mackay10-Mar-08 0:14
Colin Angus Mackay10-Mar-08 0:14 
GeneralRe: Audible Horror Pin
Dan Neely10-Mar-08 2:19
Dan Neely10-Mar-08 2:19 
GeneralRe: Audible Horror Pin
Ro0ke10-Mar-08 2:21
Ro0ke10-Mar-08 2:21 
GeneralRe: Audible Horror Pin
Pete O'Hanlon10-Mar-08 10:57
mvePete O'Hanlon10-Mar-08 10:57 
GeneralRe: Audible Horror Pin
Jasmine250112-Mar-08 7:09
Jasmine250112-Mar-08 7:09 
GeneralRe: Audible Horror Pin
David MacDermot13-Mar-08 10:16
David MacDermot13-Mar-08 10:16 
GeneralRe: Audible Horror Pin
Mario_F12-Mar-08 4:58
Mario_F12-Mar-08 4:58 
GeneralRe: Audible Horror Pin
Colin Angus Mackay12-Mar-08 5:04
Colin Angus Mackay12-Mar-08 5:04 
GeneralRe: Audible Horror Pin
Mario_F12-Mar-08 5:11
Mario_F12-Mar-08 5:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.