πŸ’‘ Developer Tips / Enable Implicit Usings in .NET 6+
dotnet

Enable Implicit Usings in .NET 6+

November 5, 2025 β€’ 1 min read
← Back to Tips
Reduce boilerplate code by automatically including common namespaces in your .NET projects. No more repetitive using statements at the top of every file!

The Solution

Add <ImplicitUsings>enable</ImplicitUsings> to your .csproj to automatically include common namespaces like System, System.Linq, System.Collections.Generic, etc.

<PropertyGroup>
  <TargetFramework>net8.0</TargetFramework>
  <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

πŸ’‘ What this does

Instead of writing these using statements in every file:

  • using System;
  • using System.Collections.Generic;
  • using System.Linq;
  • using System.Threading.Tasks;

They're automatically included! Your files become cleaner and you can focus on the actual code.

Before vs After

❌ Before (with explicit usings)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MyApp
{
    public class UserService
    {
        public async Task<List<string>> GetUserNamesAsync()
        {
            // Your code here
        }
    }
}

βœ… After (with implicit usings)

namespace MyApp
{
    public class UserService
    {
        public async Task<List<string>> GetUserNamesAsync()
        {
            // Your code here - no boilerplate!
        }
    }
}

πŸ“ Pro Tips

  • This works for .NET 6+ projects only
  • You can still add explicit using statements for less common namespaces
  • Different project types (Console, Web, etc.) include different implicit usings
  • Use <Using Remove="System.Net.Http" /> to exclude specific namespaces if needed

πŸ’¬ Comments & Reactions