Is there a way in C# to tidy up the following class declaration?
namespace Application.Namespace
{
public class MasterClass
{
public class FlyingSaucer
{
public class Rotator
{
public class Cube
{
Still maintaining the class structure, just cleaning up the declaration.
No – it’s already pretty tidy, given that you’ve got 4 levels of nesting.
But you almost certainly shouldn’t have 4 levels of nesting to start with. Why would you want to do that? You’ve got a class named
subClass1which isn’t a subclass by the normal meaning (i.e. derived from another specific class;subClass1is only derived fromobject.)Nesting classes is fairly rare – I don’t think I’ve ever seen even three levels of nesting, let alone four. Why do you think this is a good idea?