I am relatively new to C# and each time I begun to work on a C# project (I only worked on nearly mature projects in C#) - I'm wondering why there is no inner classes.
Maybe I don't understand their goal. To me, inner classes -- at least private inner classes -- look a lot like "inner procedures" in Pascal / Modula-2 / Ada : they allow to break down a main class in smaller parts in order to ease the understanding.
Example : here is what is see most of the time :
public class ClassA
{
public MethodA()
{
<some code>
myObjectClassB.DoSomething(); // ClassB is only used by ClassA
<some code>
}
}
public class ClassB
{
public DoSomething()
{
}
}
Since ClassB will be used (at least for a while) only by ClassA, my guess is that this code would be better expressed as follow :
public class ClassA
{
public MethodA()
{
<some code>
myObjectClassB.DoSomething(); // Class B is only used by ClassM
<some code>
}
private class ClassB
{
public DoSomething()
{
}
}
}
I would be glad to ear you on that subject - Am I right ?
Thanks in advance !