Tip: Make parentheses matching more visible in C#

Recently someone asked me if there was a Visual Studio add-in that highlighted parentheses, brackets, and braces so it would be easier to tell which closing parenthesis matched which opening parenthesis. (By the way, if you have a question, email me. If I think a lot of people would benefit from the answer, I'll post it. Even if I think the question is too specific, I'll try to point you in the right direction if I can.)

It turns out that Visual Studio already has a feature like this. When you place the cursor after a closing parenthesis (for example, the cursor is there right after you type the character), Visual Studio highlights that parenthesis and the matching opening parenthesis. By default the highlighting is light gray so it's not easy to see, but if you take the following steps you can make it much more obvious.

  • In the Tools menu, select Options
  • In the Options dialog, open the Environment folder and select Fonts and Colors
  • Change "Brace Matching (Rectangle)" to the color you want to use for the highlight. For example, try Yellow or Lime.

Now it will be obvious which opening parenthesis matches a closing parenthesis.

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments

Leave a comment

Submitted comments are subject to moderation before being displayed.

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.