using Directive

A using directive at the top of a C# file imports a namespace so you can use its types without typing the full path. For example, `using System;` lets you write Console instead of System.Console.

C#

Modern .NET projects often enable 'implicit usings,' which automatically include common namespaces like System, so you may not see many using lines in beginner code.

Don't confuse this with the `using` statement (with parentheses), which is a different feature that automatically disposes of resources like files.

Syntax

using Namespace;

Examples

C#

using System;
using System.Collections.Generic;

List<int> nums = new List<int> { 1, 2, 3 };
Console.WriteLine(nums.Count);

Output:

3

Learn it in a lesson

See also

Back to the Dictionary