Export (0) Print
Expand All
6 out of 14 rated this helpful - Rate this topic

Automatic Brace Matching

Automatic brace matching gives you immediate feedback on misplaced brackets or open-ended code segments. You can change the behavior of this feature by modifying the following development environment options:

Automatic brace matching recognizes the following pairs:

[C#]

( )

Parentheses

[ ]

Brackets

{ }

Braces

< >

Angle brackets

" "

A string

@" "

A verbatim string

#region - #endregion

Surrounds a collapsible block of code.

#if, #else, and #endif

Control statement keywords

[Visual Basic]

( )

Parentheses

[ ]

Brackets

{ }

Braces

<>

Angle brackets

[C++]

( )

Parentheses

[ ]

Brackets

{ }

Braces

< >

Angle brackets

#if, #else, and #endif

Conditional expression

When you type a closing bracket, both it and its matching bracket remain highlighted for a few seconds, or until you type another key or move the cursor. This makes visually identifying code blocks much easier. In addition, this may help identify mismatched or missing brackets.

When you complete a string or verbatim string by typing the closing double quotation mark ("), the editor bolds the entire string. The string remains bold until you move the cursor.

In languages other than Visual Basic, by placing the cursor to the left of a brace and pressing CTRL+], the cursor will move to the matching brace.

In Visual C#, placing the cursor to the left of an open brace or the right of a close brace will highlight the matching braces with a rectangular outline. In this case, the braces will remain highlighted until the cursor is moved. This applies to matching parenthesis, brackets, and angle brackets as well.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.