Sdílet prostřednictvím


SyntaxFacts Class

Definition

Defines a set of methods to determine how Unicode characters are treated by the C# compiler.

public ref class SyntaxFacts abstract sealed
public static class SyntaxFacts
type SyntaxFacts = class
Public Module SyntaxFacts
Inheritance
SyntaxFacts

Properties

EqualityComparer

A custom equality comparer for SyntaxKind

Methods

GetAccessorDeclarationKind(SyntaxKind)
GetAssignmentExpression(SyntaxKind)
GetBaseTypeDeclarationKind(SyntaxKind)
GetBinaryExpression(SyntaxKind)
GetCheckStatement(SyntaxKind)
GetContextualKeywordKind(String)
GetContextualKeywordKinds()
GetInstanceExpression(SyntaxKind)
GetKeywordKind(String)
GetKeywordKinds()
GetLiteralExpression(SyntaxKind)
GetOperatorKind(String)
GetPostfixUnaryExpression(SyntaxKind)
GetPrefixUnaryExpression(SyntaxKind)
GetPreprocessorKeywordKind(String)
GetPreprocessorKeywordKinds()
GetPrimaryFunction(SyntaxKind)
GetPunctuationKinds()
GetReservedKeywordKinds()
GetSwitchLabelKind(SyntaxKind)
GetText(Accessibility)
GetText(SyntaxKind)
GetTypeDeclarationKind(SyntaxKind)
IsAccessibilityModifier(SyntaxKind)
IsAccessorDeclaration(SyntaxKind)
IsAccessorDeclarationKeyword(SyntaxKind)
IsAliasQualifier(SyntaxNode)

Returns true if the node is the alias of an AliasQualifiedNameSyntax

IsAnyOverloadableOperator(SyntaxKind)
IsAnyToken(SyntaxKind)
IsAnyUnaryExpression(SyntaxKind)
IsAssignmentExpression(SyntaxKind)
IsAssignmentExpressionOperatorToken(SyntaxKind)
IsAttributeName(SyntaxNode)
IsAttributeTargetSpecifier(SyntaxKind)
IsBinaryExpression(SyntaxKind)
IsBinaryExpressionOperatorToken(SyntaxKind)
IsCheckedOperator(String)
IsContextualKeyword(SyntaxKind)
IsDocumentationCommentTrivia(SyntaxKind)
IsFixedStatementExpression(SyntaxNode)

Is the expression the initializer in a fixed statement?

IsGlobalMemberDeclaration(SyntaxKind)

Member declarations that can appear in global code (other than type declarations).

IsIdentifierPartCharacter(Char)

Returns true if the Unicode character can be a part of a C# identifier.

IsIdentifierStartCharacter(Char)

Returns true if the Unicode character can be the starting character of a C# identifier.

IsIndexed(ExpressionSyntax)

Returns true if the node is the object of an element access expression.

IsInNamespaceOrTypeContext(ExpressionSyntax)

Returns true if a node is in a tree location that is expected to be either a namespace or type

IsInstanceExpression(SyntaxKind)
IsInTypeOnlyContext(ExpressionSyntax)

Returns true if the node is in a tree location that is expected to be a type

IsInvoked(ExpressionSyntax)

Returns true if the node is the object of an invocation expression.

IsKeywordKind(SyntaxKind)
IsLambdaBody(SyntaxNode)
IsLanguagePunctuation(SyntaxKind)
IsLiteralExpression(SyntaxKind)
IsName(SyntaxKind)
IsNamedArgumentName(SyntaxNode)

Is the node the name of a named argument of an invocation, object creation expression, constructor initializer, or element access, but not an attribute.

IsNamespaceAliasQualifier(ExpressionSyntax)
IsNamespaceMemberDeclaration(SyntaxKind)
IsNewLine(Char)

Returns true if the Unicode character is a newline character.

IsOverloadableBinaryOperator(SyntaxKind)
IsOverloadableUnaryOperator(SyntaxKind)
IsPostfixUnaryExpression(SyntaxKind)
IsPostfixUnaryExpressionToken(SyntaxKind)
IsPredefinedType(SyntaxKind)
IsPrefixUnaryExpression(SyntaxKind)
IsPrefixUnaryExpressionOperatorToken(SyntaxKind)
IsPreprocessorDirective(SyntaxKind)
IsPreprocessorKeyword(SyntaxKind)
IsPreprocessorPunctuation(SyntaxKind)
IsPrimaryFunction(SyntaxKind)
IsPunctuation(SyntaxKind)
IsPunctuationOrKeyword(SyntaxKind)
IsQueryContextualKeyword(SyntaxKind)
IsReservedKeyword(SyntaxKind)
IsReservedTupleElementName(String)

Checks whether the element name is reserved.

For example: "Item3" is reserved (at certain positions). "Rest", "ToString" and other members of System.ValueTuple are reserved (in any position). Names that are not reserved return false.

IsTrivia(SyntaxKind)
IsTypeDeclaration(SyntaxKind)
IsTypeParameterVarianceKeyword(SyntaxKind)
IsTypeSyntax(SyntaxKind)
IsUnaryOperatorDeclarationToken(SyntaxKind)
IsValidIdentifier(String)

Check that the name is a valid identifier.

IsWhitespace(Char)

Returns true if the Unicode character represents a whitespace.

TryGetInferredMemberName(SyntaxNode)

Given an initializer expression infer the name of anonymous property or tuple element. Returns null if unsuccessful

Applies to