Advertisement
Intermediate C#, Modern C# Features (Global Usings, File-Scoped Namespaces, Top-Level Statements)

What does the 'ImplicitUsings' project setting (`<ImplicitUsings>enable</ImplicitUsings>`) do automatically?

Short answer

Enabling ImplicitUsings automatically adds a curated set of GLOBAL using directives for the most commonly-needed namespaces (like System, System.Linq, System.Collections.Generic, and project-type-specific ones like Microsoft.AspNetCore.Builder for web projects) WITHOUT you…

Save C# mock interview
Advertisement
AModel answer
Enabling ImplicitUsings automatically adds a curated set of GLOBAL using directives for the most commonly-needed namespaces (like System, System.Linq, System.Collections.Generic, and project-type-specific ones like Microsoft.AspNetCore.Builder for web projects) WITHOUT you writing them yourself — the exact set depends on the project's SDK type (console, web, etc.).
<!-- .csproj -->
<PropertyGroup>
  <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<!-- Now System, System.Linq, System.Collections.Generic, etc. are available everywhere automatically -->
Real-world example
Starting a new project with sensible default global usings enabled out of the box, reducing initial boilerplate.
Likely follow-ups
  • How would you find the EXACT list of namespaces implicitly included for a specific project SDK type (like Microsoft.NET.Sdk.Web)?
Related topics