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.