Thanks for the responses. I guess what had me confused is that it
seems to be a hard requirement in Java and a recommended practice in
C#. I am learning both of these concurrently and get them confused
constantly.
Java and C# are quite different in this regard.
Java requires public outer classes to be in separate
files if a file system is used to store source code
(and it is more than 10 years since I last saw something
other than a file system used) and having the directory
structure match the package structure.
C# let you choose how you want to do it.
Java:
p1/p2/C1.java with p1.p2.C1
p1/p2/C2.java with p1.p2.C2
p1/p3/C3.java with p1.p2.C3
p1/p3/C4.java with p1.p2.C4
can be done in multiple ways in C#.
Like Java:
NS1/NS2/C1.cs with NS1.NS2.C1
NS1/NS2/C2.cs with NS1.NS2.C2
NS1/NS3/C3.cs with NS1.NS2.C3
NS1/NS3/C4.cs with NS1.NS2.C4
or more compact:
NS1/NS2.cs with NS1.NS2.C1 and NS1.NS2.C2
NS1/NS3.cs with NS1.NS2.C3 and NS1.NS2.C4
If working for a company then follow the established
convention.
If just you then do whatever you think is easiest
to work with.
Arne