Brace Matching – Visual Studio C#

VISUAL STUDIO TIPS

Cool visual studio tips for productivity

Photo by Shotkit from Pexels


What is Brace Matching?

As C# uses angular braces quite extensively, brace matching helps you identify the corresponding brace pair by highlighting it as shown below.

By default, the visual studio uses a gray color highlighter to show brace matching, but the user can override the setting.

Tip 1: Changing brace matching default color

Go to Tools > Options > Environment > Fonts and Colors and select the “Brace Matching” item from the Display items list.

Now choose the foreground & background from the color palette.

Tip 2: Switch between braces with a keyboard shortcut

The above tip is really useful when a file has more lines of code or a larger document, and the user wants to know the starting curly brace of a method, class, or expression.

Shortcut: “Ctrl + ]”

Go to the start or end of any brace and then press the shortcut key. The cursor will move to the start or end of the brace respectively.

The above live demonstration shows the usage of this tip. To represent the cursor movement, I have written random text to represent where the cursor moved after the shortcut.

Thank you for reading, and I hope you liked the article. Please provide your feedback in the comment section.

Follow me on

C# Publication, LinkedIn, Instagram, Twitter, Dev.to, Pinterest, Substack, Wix.

#TipsAndTricks #VisualStudioCode #VisualStudio #TipsAndTools #Dotnet

Recent Posts

See All

Design Pattern – Adapter

#Aspnetcore #AdapterDesignPattern #Csharp #DesignPatterns #Dotnet According to Gang of Four, the Adapter Pattern converts the interfaces of a class into interfaces that the client requires. In other w