Hi friends,
I want to know that If a namespace isn't supplied, which namespace does a class belong to?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jan 23, 2012, 6:02 AM
The answer is that it doesn't support them directly but you can represent them in C# by applying some attributes to a struct or class. Check out these articles:
http://msdn.microsoft.com/en-us/library/acxa5b99(VS.80).aspx
http://www.c-sharpcorner.com/uploadfile/GemingLeader/marshaling-unions/
Jignesh TrivediPosted Jan 23, 2012, 12:43 AM
A Namespace in Microsoft .Net is like containers of objects. They may contain unions, classes, structures, interfaces, enumerators and delegates. Main goal of using namespace in .Net is for creating a hierarchical organization of program. In this case a developer does not need to worry about the naming conflicts of classes, functions, variables etc., inside a project.
In Microsoft .Net, every program is created with a default namespace. This default namespace is called as global namespace. But the program itself can declare any number of namespaces, each of them with a unique name. The advantage is that every namespace can contain any number of classes, functions, variables and also namespaces etc., whose names are unique only inside the namespace. The members with the same name can be created in some other namespace without any compiler complaints from Microsoft .Net.
VulpesPosted Jan 22, 2012, 5:21 AM
In the event of a name clash, you can clarify that a type (SomeType say) belongs to the global namespace using the following syntax:
global::SomeType
'global' is a contextual keyword (it's only a keyword when used in certain situations) and :: is called the scope resolution operator.
Krishna GaradPosted Jan 22, 2012, 12:29 AM