BadreNarayanan.V's Radio Weblog




Weblogs

















Microsoft Specs




Security


Personal Friend



Subscribe to "BadreNarayanan.V's Radio Weblog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.


Wednesday, February 05, 2003
 


A nice use for Nested classes in C#.

In C# you can put classes in a namespace like this:

namespace Foo
{
public class Bar {...}
}

or nest them like this:

public class Foo
{
public class Bar(){...}
}

Nesting classes in C# is more like C++ than Java (creating a new Foo does not imply a new Bar), so deciding which to use is to some extent a stylistic decision. That said I ran into an interesting place where nesting turned out to have a subtle advantage. I had a common base class with a bunch of derived classes, each representing a particular type of input (statements in a program in this case), so something like this:...

[Managed Space]
10:16:38 AM   comment_[]


Multi-paradigm design and generic programming. This story is back [Sam Gentile's Blog]
10:16:06 AM   comment_[]


Click here to visit the Radio UserLand website. © Copyright 2003 BadreNarayanan.V.
Last update: 9/28/2003; 12:15:58 PM.
February 2003
Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28  
Jan   Mar