Nexith
Nexith

Reputation: 475

Visual Studio 2015 - Code style settings

In the new Visual Studio 2015 I get the following "Name can be simplified" quick action. I prefer using String over string when using the static methods of the String class because gives a better overview.

I have looked for an option to customize this under: TOOLS -> Options -> Text Editor -> C# -> Code Style, but there was not much there.

Is there anyway I can customize this settings? Or even better if I can customize these settings for everyone working on the solution/project? So everyone uses the same coding style.

Upvotes: 27

Views: 7773

Answers (2)

Jenya Y.
Jenya Y.

Reputation: 3230

You can now add .editorconfig file and opt-out intrinsic predefined type keyword for expressions:

dotnet_style_predefined_type_for_member_access = false:warning

Here is a reference file from Roslyn repo.

Upvotes: 0

tagustini
tagustini

Reputation: 352

I just came across this myself and agree on String vs string for static methods. I think you were correct in looking in TOOLS -> Options -> Text Editor -> C# -> Code Style, because I unticked "Prefer intrinsic predefined type keyword in member access expressions" and this got rid of the "Name can be simplified" message that I was experiencing.

Did you try this or are you looking to have more control over the customisations?

Upvotes: 23

Related Questions