Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio C# Code colour of this

I have been fiddling with the colours of the various C# items in my new Visual Studio 2017 (Community) using the Tools->Options->Font and Colors. Everything is fine apart from the this keyword.

Does anyone happen to know which of the Display Items one can change the colour of will affect the this keyword?

like image 782
Brian Hooper Avatar asked Feb 21 '17 15:02

Brian Hooper


People also ask

Can I use Visual Studio for C?

The Microsoft C/C++ for Visual Studio Code extension supports IntelliSense, debugging, code formatting, auto-completion. Visual Studio for Mac doesn't support Microsoft C++, but does support . NET languages and cross-platform development.

Is Visual Studio C or C++?

The Visual Studio IDE supports C++ development on Windows, Linux, Android and iOS with a code editor, debugger, test frameworks, static analyzers, and other programming tools.

Is Visual Studio C C++ free?

Visual Studio Community. A fully-featured, extensible, free IDE for creating modern applications for Android, iOS, Windows, as well as web applications and cloud services.


2 Answers

There is analyzer rule

IDE0003 Name can be simplified

with the option "Remove 'this' qualification".

I found no way to set a different color, but the rule can be deactivated so the dimming is not applied: https://stackoverflow.com/a/32144170/1132334

This does specifically target this (or Me in VB).

like image 147
Cee McSharpface Avatar answered Nov 14 '22 22:11

Cee McSharpface


It's just a keyword, the same as all the others. I don't think you can tell VS to highlight it differently to other keywords.

like image 36
Jon Skeet Avatar answered Nov 14 '22 21:11

Jon Skeet