I'm working on some MonoTouch code that I derived from one of the samples (this is not a MonoTouch specific question) and the sample code declares a private class inside another class. I've not seen private classes used much in c# and I'm at a loss as to when it might make sense. I can see how a class that is only referenced within another class could be declared private but isn't this going to cause more grief than it's worth? Doesn't this break a number of the SOLID principles?
- Single Responsibility - broken?
- Open/Closed - broken?
- Liskoff Substitution - maybe ok?
- Interface Segregation - broken?
- Dependency Inversion - broken?
Right now I'm finding it confusing just trying to navigate the source because of the private class definition. I guess this could be mitigated somewhat by declaring a partial class to contain the private class and separating them into separate files that way but is this really a good approach?