Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: VS.NET
Expertise: beginner
Aug 4, 2003



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Marking strings with a different color in source code documents

When you build strings by concatenating hardcoded constant strings and variable strings, it's easy to forget a closing double quote, and thus receive a compile time error when you launch or compile the program (actually, you see that there is a syntax error even before, because the statement gets underlined to signal the error). VS.NET's syntax highlighting feature can make things much easier, by using a different color to mark the hardcoded strings present in your code.

To specify a color different from the default (also used for normal text/code), open the Options dialog window (Tools | Options...), select the Environment | Fonts and Colors page, select String from the listbox control, and finally select a color for it, red for example. Go back to the source code editor, and note that the strings are rendered in red, making it easier to quickly find them among the rest of the code. When you're writing code and type a double quote ( " ), the following code will be immediately rendered in red until you type a closing double quote - this way you'll never miss a double quote again!

Marco Bellinaso
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date