2

I am using the Visual Studio CodeMaid plugin currently and when I press Ctrl+m+space to cleanup my active document it adds a default access modifier of internal to my class/interface/etc.. I've looked through the options to change it to be public, but haven't had any luck. Is it possible to change this?

httpNick
  • 2,524
  • 1
  • 22
  • 34

1 Answers1

3

For most member types:

internal is the default if no access modifier is specified. Access Modifiers (C# Programming Guide)

CodeMaid has the option to explicitly specify the access modifier in order to reduce the chance for developer confusion. You can disable this behavior at CodeMaid->Options->Cleaning->Insert->"Insert explicit access modifiers for" and toggle individual member types (e.g. classes, properties, etc.)

If you want to change something from its default internal to public, you will need to explicitly add the public access modifier.

Hope it helps.

Steve Cadwallader
  • 2,656
  • 4
  • 28
  • 37
  • Thanks for the response, when you say "from its default internal to public, you will need to explicitly add the public access modifier." you mean manually removing `internal` and typing out `public` right? – httpNick Sep 27 '16 at 18:29
  • Yes, or typing in `public` before invoking CodeMaid. If an access modifier is already specified, CodeMaid won't add the default. – Steve Cadwallader Sep 27 '16 at 19:22
  • A workaround is to edit the Visual Studio class template, and add the public modifier there. As explained here: https://stackoverflow.com/a/16781044/552294 – rolandow May 03 '22 at 08:30