logo search
Учебник_ПОА

Using Directives and Namespaces

When you create a console application with Visual C#, the first lines in the code editor contain using directives listing several .NET Framework namespaces. A namespace is a way of grouping classes and structs together in a way that limits their scope and avoids name conflicts with other classes and structs. When you create a program in Visual C#, a namespace is automatically created for you. To use classes from other namespaces in your program, you must specify them with a using Directive. The most commonly used.NET Framework namespaces are listed by default when you create a new application. If you use classes from other namespaces in the class library, you must add a using directive for that namespace to the source file.

When the Code Editor detects that you have declared a class or struct that it cannot find in the namespaces listed in the current using directives, it will suggest namespaces that contain the class or struct.