Let’s say I have a non-static, class with 2 levels of nested classes inside.
public class A
{
public class B
{
public class C{}
}
}
How instances are created when I want to create:
- a) an instance of the master level class (new A())?
- b) an instance of the deepest level class (new C())?
What are performance and memory issues possible with such implementation?
Thanks!
Unlike Java, a nested class in the CLR has no special properties that make it behave different from a class declared at namespace scope. Layout and allocation behavior is identical. It only affects scope. The only advantage of nesting a class is that you can make it private.