/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/csharp/language-reference/keywords/snippets/csrefKeywordsNamespace.cs
67 строк
992 B
Bill Wagner
Articles for file scoped namespaces (#25710)
20 авг 2021, 23:24
Не верифицирован
20 авг 2021, 23:24
7e12aa3
Код
Авторство
О чём код?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; //<snippet1> namespace SampleNamespace { class SampleClass { } interface ISampleInterface { } struct SampleStruct { } enum SampleEnum { a, b } delegate void SampleDelegate(int i); namespace Nested { class SampleClass2 { } } } //</snippet1> //<snippet2> namespace MyCompany.Proj1 { class MyClass { } } namespace MyCompany.Proj1 { class MyClass1 { } } //</snippet2> //<snippet3> namespace SomeNameSpace { public class MyClass { static void Main() { Nested.NestedNameSpaceClass.SayHello(); } } // a nested namespace namespace Nested { public class NestedNameSpaceClass { public static void SayHello() { Console.WriteLine("Hello"); } } } } // Output: Hello //</snippet3>