In Java the file name must be the public class name defined in that java file. Does C# has similar requirement? can I have a A.cs file which only defines a public Class B inside? thanks,
No, there is no similar requirement.
Yes, you can do this.
It is considered bad practice, however.
Microsoft StyleCop will warn you if you do this, but everything will compile fine.
1.4m articles
1.4m replys
5 comments
57.0k users