Implicit using is a feature which comes with C# 10. The question is how to find candidates for implicit usings in some C# project. For this task following PowerShell snippet can be used:
Get-ChildItem *.cs -Exclude *assembly* -Recurse ` | Get-Content ` | Select-String using ` | Group-Object ` | Sort-Object -Property Count -Descending
After running this command in folder with some C# files you can discover repeating usings, for example that in unit tests are repeating using of FluentAssertions and Xunit which can be added into .csproj file as implicit usings:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net6.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> </PropertyGroup> <ItemGroup> <Using Include="FluentAssertions" /> <Using Include="Xunit" /> </ItemGroup> </Project>