+ 1
What is uses of namespace in c#?
I create 2 program with 2 class. first with namespace and second without namespace. What is difference between them? Both are working like same.
3 Answers
+ 2
for more information about namespaces check this link out
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/namespaces/using-namespaces
+ 1
Hi, namespaces use for managing your dlls and projects. Classes with the same namespace must have unique name. Therefore you can define classes with same name in different namespaces. Namespace tells you where your classes belong to, then it can be infered from namespace that what kind of responsibities your class might have. For example you can have three class with name of "Order", with three different namespaces as follow: " domain.entity" , "domain.service" , "presentation.viewmodels". Each of these classes have different responsibility which I am sure you can comprehend them as you see their namespace.
0
when our project has many classes then it is difficult to manage them . so namespace is used for grouping the related class together.