Home > Mobile >  DotNet Naming rule for auto property fields
DotNet Naming rule for auto property fields

Time:06-03

Is there a way to change the naming conventions for auto properties to camelCase. E.g. with the .editorconfig file?

screenshot vscode

Thanks!

CodePudding user response:

You can set the naming rules from this path: Visual Studio -> Tool -> Options -> Text Editor -> C# -> Code Style -> Naming

enter image description here

Click the Manage naming styles button and add a naming style like this; enter image description here

Then select the naming style that you created for Non-Field Members. enter image description here

CodePudding user response:

For the .editorconfig file that would be:

dotnet_naming_rule.non_field_members_should_be_camelcase.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_camelcase.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_camelcase.style = camelcase

dotnet_naming_style.camelcase.required_prefix =
dotnet_naming_style.camelcase.required_suffix =
dotnet_naming_style.camelcase.word_separator =
dotnet_naming_style.camelcase.capitalization = camel_case
  • Related