What is a namespace in C# and what is it good for?
Experience Level: Junior
- A namespace is like a box that you can use for storing your classes.
- It is used for organizing code.
- A namespace can contain zero, one or more classes.
- A namespace is created using
- A namespace name consists of one string or multiple strings delimited by dot character.
- It is a best practice to start each word of the namespace name by a capital letter.
- One namespace can be used in multiple .cs files.
- There can be multiple namespaces in one .cs file.
Related C# job interview questions
.NET ASP.NET MVC ASP.NET WebAPI ASP.NET WebForms C# Senior
Have you ever consumed some 3rd party API? What was it? Have you ever designed your own API? Could you describe it a bit?.NET Architecture ASP.NET WebAPI C# Web services Mid-level