SyntaxFactory.LiteralExpression(SyntaxKind, SyntaxToken) Method

Definition

Represents a literal. The kind of literal is determined by the Kind property: IntegerLiteral, CharacterLiteral, BooleanLiteral, DecimalLiteral, FloatingLiteral, DateLiteral or StringLiteral. The value of the literal can be determined by casting the associated Token to the correct type and getting the value from the token.

C#
public static Microsoft.CodeAnalysis.VisualBasic.Syntax.LiteralExpressionSyntax LiteralExpression(Microsoft.CodeAnalysis.VisualBasic.SyntaxKind kind, Microsoft.CodeAnalysis.SyntaxToken token);

Parameters

kind
SyntaxKind

A SyntaxKind representing the specific kind of LiteralExpressionSyntax. One of CharacterLiteralExpression, TrueLiteralExpression, FalseLiteralExpression, NumericLiteralExpression, DateLiteralExpression, StringLiteralExpression, NothingLiteralExpression.

token
SyntaxToken

The token that represents the literal. The Kind property determines what type this property returns: Kind=IntegerLiteral ==> Returns IntegerLiteralToken. Kind=CharacterLiteral ==> Returns CharacterLiteralToken. Kind=DecimalLiteral ==> Returns DecimalLiteralToken Kind=FloatingLiteral ==> Returns FloatingLiteralToken Kind=DateLiteral ==> Returns DateLiteralToken Kind=StringLiteral ==> Returns StringLiteralToken Kind=BooleanLiteral ==> Returns Keyword (with it's kind being TrueKeyword or FalseKeyword) Kind=NothingLiteral ==> Returns Keyword (with it's kind being NothingKeyword)

Returns

Applies to

Tuote Versiot
Roslyn 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0, 3.9.0, 3.10.0, 3.11.0, 4.0.1, 4.1.0, 4.12.2, 4.13.0