C#C
C#6mo ago
Faker

✅ Solution, namespace, using statements

Hello, I always forgot about the differences between a solution vs namespace and why we make use of the using statements. I want to clarify that. From what I know, a solution is just there to show us how are projects are organised, whether Project A is inside Project B or which Projects do we have, whether these are C,D and E.

Now, the namespace is misleading, what does it do? From what I've understood, when we create a C# file, we use a namespace to "logically" group it so basically, it refers to the project we are currently working? (What about C# files with top level statements? Do they have a namespace by default?)

For example, say we have project A,B and C. Each one will have their namespace? I'm a bit confused about that. When we create multiple classes, do they have multiple namespaces or just the namespace of the project?

One thing I noticed, sometimes, we declare namespace as: namespace name {...} but sometimes, we simply write namespace name;, these 2 are similar?

For the using keyword, I did understand that in order to use particular things in particular namespace, we must first make them available where we are currently is so that we can reference them, that's why we use the using keyword? Without this keyword will it still be possible to reference them, like typing full name,System.Generic... ?
Was this page helpful?