15
Brace Matching in C#
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.
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.
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.
15