I want my Visual Studio to generate libraries such:
using System.Collections.Generic;
using System.Linq;
each time I create a new project or solution. Is that possible?
I want my Visual Studio to generate libraries such:
using System.Collections.Generic;
using System.Linq;
each time I create a new project or solution. Is that possible?
If you're using C# 10+ (default with .NET 6+), you can enable ImplicitUsings
in your project file. There are a handful of common namespaces (including the two you mention) that are then automatically imported for all your code files. More info here: https://devblogs.microsoft.com/dotnet/welcome-to-csharp-10/#global-and-implicit-usings
Your .csproj
file might look like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>