Skip to content
Learn Netverks

Lesson

Step 11/36 31% through track

namespaces-usings

Namespaces and usings

Last reviewed May 28, 2026 Content v20260528
Track mode
server_compiled
Means
Compiled runner
Reading
~1 min
Level
beginner

This lesson

This lesson teaches Namespaces and usings: the syntax, patterns, and safety habits you need before advancing in C#.

Teams still ship Namespaces and usings in C# codebases—skipping it leaves gaps in debugging and code reviews.

You will apply Namespaces and usings in contexts like: .NET services, Unity games, and Windows-centric tooling.

Write C# with Console.WriteLine (top-level or Program), click Run on server—the dev runner uses dotnet build/run on a temp net8 project (requires .NET SDK; LEARNING_RUNNER_ENABLED=true).

When you can explain the previous lesson's ideas without copying starter code.

Namespaces group types and prevent name collisions. The Base Class Library lives under System.*—hence System.Collections.Generic.List<T> and System.Console.

using directives

using System;
using System.Collections.Generic;

namespace MyApp.Utils {
    public static class MathHelper {
        public static int Double(int x) => x * 2;
    }
}

using imports namespaces so you can write List<int> instead of the fully qualified name. File-scoped namespaces (namespace MyApp;) reduce indentation in modern C#.

Important interview questions and answers

  1. Q: namespace vs assembly?
    A: Namespaces organize source-level names; assemblies are deployment units (.dll) containing IL—the CLR loads assemblies, not namespaces directly.
  2. Q: global using?
    A: SDK-style projects can declare global using System; once for the whole project—common in .NET 6+ templates.

Self-check

  1. What keyword imports a namespace?
  2. Where does Console live by default?

Tip: Namespaces organize source names; assemblies are deployment units—the CLR loads .dll files, not namespaces directly.

Interview prep

namespace vs assembly?

Namespaces organize source-level names; assemblies are deployment units (.dll) containing IL—the CLR loads assemblies.

What is a global using?

global using System; applies to the entire project—reduces boilerplate in SDK-style templates.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • global using?
  • File-scoped namespace?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump