Search code examples
c#visual-studio-2017editor

Why does Visual Studio dim the word 'String' in C# Text Editor


When upgrading from VS2013 to VS2017, I imported my previous environment settings but I'm encountering this odd editor behavior where the word 'String' is constantly dimmed:

enter image description here

The keyword 'string' is properly colored when in lowercase.

To be clear, it's using the proper color, that is, the color I'd expect when typing a classname as opposed to a keyword. But for some reason, it's dimming it the same way it would dim an unneeded 'using' statement or unreachable code.

Presumably the fix is in Options > Text Editor > C# somewhere but I can't seem to find it.


Solution

  • Because it is better practice to use string (lowercase) than String (with a big S). These are the C# built-in types. You will see that "string" is the basic value type. "String" is an alias. The greying out is hinting at this.

    If you hover over it, you will get a refactoring recommendation.

    enter image description here