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?

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

3 Comments

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?
Yes, or typing in public before invoking CodeMaid. If an access modifier is already specified, CodeMaid won't add the default.
A workaround is to edit the Visual Studio class template, and add the public modifier there. As explained here: stackoverflow.com/a/16781044/552294

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.