Share via


SyntaxFactory.Token Method

Definition

Overloads

Token(SyntaxKind)

Creates a token corresponding to a syntax kind. This method can be used for token syntax kinds whose text can be inferred by the kind alone.

Token(SyntaxTriviaList, SyntaxKind, SyntaxTriviaList)

Creates a token corresponding to syntax kind. This method can be used for token syntax kinds whose text can be inferred by the kind alone.

Token(SyntaxTriviaList, SyntaxKind, String, String, SyntaxTriviaList)

Creates a token corresponding to syntax kind. This method gives control over token Text and ValueText.

For example, consider the text '<see cref="operator &#43;"/>'. To create a token for the value of the operator symbol (&#43;), one would call Token(default(SyntaxTriviaList), SyntaxKind.PlusToken, "&#43;", "+", default(SyntaxTriviaList)).

Token(SyntaxKind)

Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs

Creates a token corresponding to a syntax kind. This method can be used for token syntax kinds whose text can be inferred by the kind alone.

public:
 static Microsoft::CodeAnalysis::SyntaxToken Token(Microsoft::CodeAnalysis::CSharp::SyntaxKind kind);
public static Microsoft.CodeAnalysis.SyntaxToken Token (Microsoft.CodeAnalysis.CSharp.SyntaxKind kind);
static member Token : Microsoft.CodeAnalysis.CSharp.SyntaxKind -> Microsoft.CodeAnalysis.SyntaxToken
Public Shared Function Token (kind As SyntaxKind) As SyntaxToken

Parameters

kind
SyntaxKind

A syntax kind value for a token. These have the suffix Token or Keyword.

Returns

Applies to

Token(SyntaxTriviaList, SyntaxKind, SyntaxTriviaList)

Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs

Creates a token corresponding to syntax kind. This method can be used for token syntax kinds whose text can be inferred by the kind alone.

public:
 static Microsoft::CodeAnalysis::SyntaxToken Token(Microsoft::CodeAnalysis::SyntaxTriviaList leading, Microsoft::CodeAnalysis::CSharp::SyntaxKind kind, Microsoft::CodeAnalysis::SyntaxTriviaList trailing);
public static Microsoft.CodeAnalysis.SyntaxToken Token (Microsoft.CodeAnalysis.SyntaxTriviaList leading, Microsoft.CodeAnalysis.CSharp.SyntaxKind kind, Microsoft.CodeAnalysis.SyntaxTriviaList trailing);
static member Token : Microsoft.CodeAnalysis.SyntaxTriviaList * Microsoft.CodeAnalysis.CSharp.SyntaxKind * Microsoft.CodeAnalysis.SyntaxTriviaList -> Microsoft.CodeAnalysis.SyntaxToken
Public Shared Function Token (leading As SyntaxTriviaList, kind As SyntaxKind, trailing As SyntaxTriviaList) As SyntaxToken

Parameters

leading
SyntaxTriviaList

A list of trivia immediately preceding the token.

kind
SyntaxKind

A syntax kind value for a token. These have the suffix Token or Keyword.

trailing
SyntaxTriviaList

A list of trivia immediately following the token.

Returns

Applies to

Token(SyntaxTriviaList, SyntaxKind, String, String, SyntaxTriviaList)

Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs
Source:
SyntaxFactory.cs

Creates a token corresponding to syntax kind. This method gives control over token Text and ValueText.

For example, consider the text '<see cref="operator &#43;"/>'. To create a token for the value of the operator symbol (&#43;), one would call Token(default(SyntaxTriviaList), SyntaxKind.PlusToken, "&#43;", "+", default(SyntaxTriviaList)).

public:
 static Microsoft::CodeAnalysis::SyntaxToken Token(Microsoft::CodeAnalysis::SyntaxTriviaList leading, Microsoft::CodeAnalysis::CSharp::SyntaxKind kind, System::String ^ text, System::String ^ valueText, Microsoft::CodeAnalysis::SyntaxTriviaList trailing);
public static Microsoft.CodeAnalysis.SyntaxToken Token (Microsoft.CodeAnalysis.SyntaxTriviaList leading, Microsoft.CodeAnalysis.CSharp.SyntaxKind kind, string text, string valueText, Microsoft.CodeAnalysis.SyntaxTriviaList trailing);
static member Token : Microsoft.CodeAnalysis.SyntaxTriviaList * Microsoft.CodeAnalysis.CSharp.SyntaxKind * string * string * Microsoft.CodeAnalysis.SyntaxTriviaList -> Microsoft.CodeAnalysis.SyntaxToken
Public Shared Function Token (leading As SyntaxTriviaList, kind As SyntaxKind, text As String, valueText As String, trailing As SyntaxTriviaList) As SyntaxToken

Parameters

leading
SyntaxTriviaList

A list of trivia immediately preceding the token.

kind
SyntaxKind

A syntax kind value for a token. These have the suffix Token or Keyword.

text
String

The text from which this token was created (e.g. lexed).

valueText
String

How C# should interpret the text of this token.

trailing
SyntaxTriviaList

A list of trivia immediately following the token.

Returns

Applies to