Configuring C# Styles

The following section describes the color settings related to the C# programming language. These settings are available from the File Types tab of the Settings dialog by selecting the "C#" category shown in the dialog below.

 

       

 

The following table describes the list of lexer settings that may be configured for the C# language type.

 

Lexer Setting

Description

Brace Highlighting

The Brace Highlighting category occurs when the cursor is adjacent to an opening brace that is matched by a closing brace or vice versa. Brace matching occurs on the following set of braces:

 

( and)

{ and }

[ and ]

 

The following example demonstrates this category:

 

    

 

In this case the opening { of the for loop and its closing } brace match and are categorized as "Brace Highlighting" and highlighted in the color and font specified by the user (red in this case).

 

Comments

The Comments category applies to standard multi-line comments of the form /* ... */ as well as single line comments of the form// ..

 

The following example demonstrates the highlighting of comments:

 

    

 

In this case both comments are categorized as "Comments" and highlighted in the color and font specified by the user (green in this case).

 

Default

The Default category really only applies to virtual space that is not occupied by characters or whitespace. In this case both the foreground color and the font settings have no purpose, only the background color is used. It is provided to allow the user to maintain a consistent color across all styles when changing the background color.

 

The following example demonstrates this category:

 

    

 

In this case all virtual space that is not occupied by characters or whitespace is categorized as the "Default" category and highlighted in the color and font specified by the user (grey in this case).

 

Identifiers

The Identifiers category applies to such things as variable names, function names, class names, and constants.

 

The following example demonstrates this category:

 

    

 

In this case the words func, mystring, count, Console, and WriteLine are categorized as "Identifiers" and highlighted in the color and font specified by the user (blue in this case).

 

Indent Guides

The Indent Guides category applies to the indent guides if they are displayed. Note that the font size does not apply

 

The following example demonstrates the this category:

 

    

 

In this case the indent guides are displayed and highlighted in the color and font specified by the user (red in this case).

 

Keywords

The Keywords category applies to the Java keywords that form part of the language standard.

 

The following example demonstrates this category:

 

    

 

In this case the words void, string, and for and int are categorized as "Keywords" and are highlighted in the color and font specified by the user (blue in this case).

 

Line Numbers

The Line Numbers category applies to the line numbers displayed in the left hand column.

 

The following example demonstrates this category:

 

    

 

In this case the line numbers are highlighted in the color and font specified by the user (black on a grey background in this case).

 

Mismatched Brace

The Mismatched Brace category occurs when an opening brace has no closing brace or vice versa. This will only be displayed if the cursor currently located adjacent to the brace. Brace matching occurs on the following sets of braces:

 

( and)

{ and }

[ and ]

 

The following example demonstrates this category:

 

    

 

In this case the opening { in the for loop has no closing brace so it is categorized as "Mismatched Brace" and highlighted in the color and font specified by the user (red in this case).

 

Numbers

The Numbers category applies to any numbers contained in the file. Line numbers are categorized separately.

 

The following example demonstrates this category:

 

    

 

In this case the numbers 20, and 0 are categorized as "Numbers" and are highlighted in the color and font specified by the user. (red in this case).

 

Open Strings

The Open Strings category applies to both single and double quoted strings that have not been closed by a corresponding closing single or double quote.

 

The following example demonstrates this category:

 

    

 

In this case the word"this is a test string is categorized as an "Open String" because there is no closing quote at the end of the string. It is highlighted in the color and font specified by the user (red in this case).

 

Operators

The Operators category applies to any operators contained in the file such as +, -, ++, <, >, etc. Note that braces are highlighted in an alternate color if the cursor is adjacent. Refer to the Brace Highlight and Bad Brace categories for more information.

 

The following example demonstrates this category:

 

    

 

In this case the operators =, {, }, ; , < and ++ are categorized as "Numbers" and are highlighted in the color and font specified by the user. (red in this case).

 

Preprocessor

The Pre-processor category includes all instances of the pre-processor. The following example demonstrates the pre-processor category:

 

    

 

In this case the #if, and #endif strings are categorized as "Preprocessor" and are highlighted in the color and font specified by the user (red in this case).

 

Secondary Keywords

For every language it is possible to define secondary keywords or identifiers that the user wants to have highlighted. The Secondary Keywords category applies to such identifiers.

 

The following example demonstrates this category where the C# Hashtable class name has been added to the secondary keywords list:

 

    

 

In this case the word Hashtable is categorized in the "Secondary Keywords" category and highlighted in the color and font specified by the user (red in this case).

 

Strings

The Strings category applies to strings that are enclosed in double or single quotes.

 

The following example demonstrates an example of a single quoted string:

 

   

 

In this case the string enclosed in single quotes is categorized as "Strings" and highlighted in the color and font specified by the user (red in this case).

 

Whitespace and Control Characters

The Whitespace and Control characters category applies to any whitespace and control characters that are displayed.

 

The following example demonstrates this category:

 

    

 

In this case, any spaces, tabs or control characters are categorized as "Whitespace and Control Characters" and highlighted in the color and font specified by the user (underlined red in this case).