Whenever I create new classes using Visual Studio 2010 Express C# it creates them with no access modifier. 9 times out of 10 I want my new classes to be public. How can I have Visual Studio create empty class templates with the "public" modifier by default?
The trick is to create a new item template named Class. Then when you do Add > New Class, your template will be selected by default rather than the built-in Class template. (I am not sure if this behaviour is guaranteed but it Works On My Machine (TM).) To create the template:
Now do an Add > Class and you should see your Class template being used by default instead of the built-in one.
You can Define Your Own Item Templates.
Visual Studio Templates
They are supported in the Express Edition as well: Creating Visual Studio Express Templates
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