C# .cs file name and class name need to be matched?
问题 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, 回答1: 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. 回答2: No, there is not a requirement that the filename matches a single public class being defined in the file. In fact, it