CSharpFormattingInfo Class

Provides formatting info for C# code.

Definition

Namespace: Ookii.FormatC
Assembly: Ookii.FormatC (in Ookii.FormatC.dll) Version: 2.3.2+a0abe9e363271833c90424d1444b43a67fa5858f
C#
public class CSharpFormattingInfo : IFormattingInfo, 
	IFormattingInfoWithTypes
Inheritance
Object    CSharpFormattingInfo
Implements
IFormattingInfo, IFormattingInfoWithTypes

Remarks

C# contains several keywords that are contextual keywords. For example, from is a keyword in a Linq expression, but not elsewhere, and you can still have variables named from without prefixing them with @.

Because of the limitations of regular expressions, the CSharpFormattingInfo cannot determine when a contextual keyword should be treated as a keyword and when it should be treated as a regular identifier. Because of this, it always treats them as keywords.

You can prefix an identifier that is also a contextual keyword with ` (e.g. `from) to prevent it from being highlighted as a keyword. The ` character will not appear in the formatted output, and the identifier will not be highlighted.

You can specify identifiers that should be colored as type names using the Types property. These identifiers will then always be formatted as type names (even in contexts where they are not). Like with contextual keywords, you can prefix an identifier with ` to prevent it from being highlighted as a type name.

Constructors

CSharpFormattingInfo Initializes a new instance of the CSharpFormattingInfo class.

Properties

CaseSensitive Gets a value that indicates whether the language to be formatted is case sensitive.
Patterns Gets a list of regular expression patterns used to identify elements of the code.
Types Gets or sets a list of identifiers that should be treated as type names.

Methods

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ToStringReturns a string that represents the current object.
(Inherited from Object)

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also