[C# Helper]
Index Books FAQ Contact About Rod
[Essential Algorithms, Second Edition]

[The Modern C# Challenge]

[WPF 3d, Three-Dimensional Graphics with WPF and C#]

[The C# Helper Top 100]

[Interview Puzzles Dissected]

[C# 24-Hour Trainer]

[Beginning Software Engineering]

[C# 5.0 Programmer's Reference]

[MCSD Certification Toolkit (Exam 70-483): Programming in C#]

Title: Tip: Make parentheses matching more visible in C#

[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.

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" to the color you want to use for the highlight. For example, try Yellow or Lime.

This seems to work in Visual Studio 2022. If it doesn't work in your version, try setting "Brace Matching (Rectangle)."

The exact appearance of the Options dialog has changed in different versions of Visual Studio, but the general location of this option has remained the same: Tools > Options > Environment > Fonts and Colors > Brace Matching.

Now it will be obvious which parentheses form a pair.

© 2009-2022 Rocky Mountain Computer Consulting, Inc. All rights reserved.