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!

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS