And what is the recommended file structure?
The question is a bit similar to this one, but I'm looking for more explicit recommendations.
In theory I think it's a good concept to keep files short so you don't see other noise of nested classes where you're not interested in the implementation details at that point in time.
I think there are then two options left (but maybe I'm missing something).
Option A using partials and nested classes:
ClassA.cs
namespace Example
{
public partial ClassA
{
[...]
}
}
ClassA.Helpers.cs
namespace Example
{
public partial ClassA
{
private class ClassB
{
[...]
}
private class ClassC
{
[...]
}
}
}
What I don't like here is the extra indention from the class - it makes it a bit harder to read, because your eye is used to scan for i.e. two indentions for class members.
Option B: don't make it a nested class, but make it an internal class within it's own namespace - so it doesn't pollute the main namespace:
ClassA.cs
namespace Example
{
public class ClassA
{
}
}
Helpers/ClassB.cs
namespace Example.Helpers
{
internal class ClassB
{
}
}
Am I missing a third option? Are there any recommendations, defaults or guidelins