0

I have a class from somewhere. The name is strange, it is called "Something[into]ABC.cs". Is it valid for "[into]" in a class name?

1 Answers1

3

It should be noted that the CLI allows names that are illegal in C# (a trick that the C# compiler itself exploits when it "names" anonymous types): however - a type name cannot contain . (that would signify a namaspace), and a little checking shows that [ / ] must be escaped when used in names; so it would be a\[b\] (or a\\[b\\] when written as a C# string). I think we can conclude, therefore, that you do not have a class named Something[into]ABC.cs. I suspect you have a file named that instead, with the class somewhat more sane.

File names do not define the class name, although it is considered polite to keep the two in sync.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900