- 1
Why It is necessary to add namespace in this app?
in visual studio we can run program without namespace also? why?
3 Antworten
+ 1
No you cannot however I am not sure it is about the reference stuff or IDE needs it only. But since the name of the program is also a namespace might be about the compiler.
+ 1
It is just to keep an order in your code.
when you are working in a solution with several projects, and for example two of them have a class called DatabaseAdmin, if you don't use the namespaces.you will have troubles because of the ambiguety.
by default the name space is the same as your project, but you can order your classes in different namespaces. and later if you want to call another class from a different namespace you have to add a using with their name.
Its somewhat like packages in Java. The only difference is that in Java is a must do and in c# is optional.
hope to help. I'm still working in my English.
- 3
enjoy