When I generate a new class in Visual Studio (C#), I would like to have the default access modifier changed from "internal" to "public". E.g.:
public class Animal
{
}
instead of:
internal class Animal
{
}
Is there a setting in Visual Studio (2022) where the default access modifier for new classes can be set?
I tried same for Visual Studio Community 2022 (V 17.1.0)
Open Class.cs
at
%ProgramFiles%\Microsoft Visual Studio\2022\Community\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class\Class.cs
The Class.cs file location depends on your installation directory.
Existing class code
class $safeitemrootname$
{
}
Add public
keyword
public class $safeitemrootname$
{
}
and Save the file. It's working on my machine.
You can change it at
%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With