- Setup your environment - How to video
- Visual Studio Community Install the latest version
- .NET Install the latest version
- Update the default C# Class in Visual Studio, everytime you create a new class it will use this template.
- Open the following file in a text editor
C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class\Class.cs
Change the template to the following, move using inside of the namespace and public before the class.
namespace $rootnamespace$;
using System.Collections.Generic;
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
$endif$using System.Text;
$if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;
$endif$
public class $safeitemrootname$
{
}
Do the same with the Interface Template
C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\Common7\IDE\ItemTemplates\CSharp\Code\1033\Interface\Interface.cs
namespace $rootnamespace$;
using System.Collections.Generic;
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
$endif$using System.Text;
$if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;
$endif$
public interface $safeitemrootname$
{
}
Browse to visualstudio.vssettings
At the bottom of Visual Studio click on the broom and choose Configure Code Cleanup. Choose everything except the bottom 2.
Note on any file you can press Ctr+K and then Ctrl+E to cleanup your code. This helps for consitency and clean code.