in a C# assembly, can we have a file for example File1.cs that is in the same namespace as that assembly but it does Not have a class?
so for example something like this:
namespace something.otherthing
{
public enum E1
{ ..... }
public enum E2
{ ... }
}
I think this should be Wrong? but we could do that in VB 6.0 but in C# every thing should be a class.
wanted to make sure .
File names have nothing to do with namespaces. Any namespace that’s at the top of the file is where the enums are, so if that’s
something.otherthingthe enums are available withsomething.otherthing.E1. You can have multiple classes in one file, you can have part of a class in a file, you can have no classes at all in a file, you can have enums with classes in a file, etc. Files are just for you, they don’t mean anything.