1

I'm very new Visual Studio and C# coding. I'm curious if there's a way to have a different font color for new object names my code makes. For example, in the below code, I would like to control the foreground (or maybe even background) color for myCommand and myConnection below:

SqlCommand myCommand = myConnection.CreateCommand();
myCommand.CommandText = "GetCustomers";
myCommand.CommandType = System.Data.CommandType.StoredProcedure;

I already tried looking under Tools\Options\Environment\Fonts and Colors; but, I couldn't find the item I was looking for.

Edit

If there isn't a native feature to do this, is there a way to enhance VS2013 to do this?

halfer
  • 19,824
  • 17
  • 99
  • 186
MKANET
  • 573
  • 6
  • 27
  • 51
  • 1
    possible duplicate of [Coloring instance variables in Visual Studio](http://stackoverflow.com/questions/5574794/coloring-instance-variables-in-visual-studio) – RB. May 07 '14 at 15:29
  • I've just noticed this is technically a duplicate (http://stackoverflow.com/questions/5574794/coloring-instance-variables-in-visual-studio), but my answer isn't on that question, so I'm going to leave it here. – RB. May 07 '14 at 15:30

2 Answers2

1

You need to set the color for "Identifier" in Tools\Options\Environment\Fonts and Colors.

Note this will change variables, but also members and member definitions, so it might be more than you wanted.

RB.
  • 36,301
  • 12
  • 91
  • 131
  • 1
    Thanks for the quick response. Yes, the "Identifier" color highlights much more items than I want. – MKANET May 07 '14 at 15:26
  • Yeah, it's a shame. If you look at the list, it's clear that C++ has much more fine-grained control than C# - what you want is easy to achieve in C++. – RB. May 07 '14 at 15:28
1

It appears that supplementary C# syntax highlighting for Visual Studio is NOT free. The enhancements I was looking for can be done with the two below extensions. Both of which I think are completely overpriced for syntax-highlighting alone; especially it's for personal/non-business use. The first extension at least offers a discount for academic use for $50.

Visual Assist Extension

and

VS10x Editor View Enhancer

MKANET
  • 573
  • 6
  • 27
  • 51