There are languages where this is not permitted. However, in C# you can
spread the code over files almost as much as you like. Neither the class
mane needs to match the file name nor the nemespace needs to match the
path nor a class has to be defined in a single file (partial classes)
nor one file could contain only one class. It is only a question of code
From my point of view the code should primarily be readable. And
whatever is required to meet this demand should be done. Strict coding
rules usually do not always hit the nail on the head. Sometime it is a
good advise to spread a class over files. First of all in case of
generated code (which itself is a work-around for some other problem).
Secondly a nested class might be better placed in a separate file if it
is rather large. On the other hand small classes or interfaces or enums
that are dedicated to a single class only, might be naturally placed in
the class file without causing any confusion.