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

Namespace Shortcuts

To use the method WriteLine, defined in the Console class contained in the System namespace, you would use a line of code like this:

System.Console.WriteLine("Hello, World!");

Remembering to precede all the methods contained in Console with System would quickly become tiresome, so a useful shortcut is to insert the using Directive at the start of your C# source file, like this:

using System;

Including using System; establishes that the System namespace is assumed, and you can subsequently write just this:

Console.WriteLine("Hello, World!");