Sdílet prostřednictvím


PatternSyntax Class

Definition

public ref class PatternSyntax abstract : Microsoft::CodeAnalysis::CSharp::CSharpSyntaxNode
public abstract class PatternSyntax : Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode
public abstract class PatternSyntax : Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionOrPatternSyntax
type PatternSyntax = class
    inherit CSharpSyntaxNode
type PatternSyntax = class
    inherit ExpressionOrPatternSyntax
Public MustInherit Class PatternSyntax
Inherits CSharpSyntaxNode
Public MustInherit Class PatternSyntax
Inherits ExpressionOrPatternSyntax
Inheritance
Inheritance
Derived

Properties

ContainsAnnotations

Determines whether this node or any sub node, token or trivia has annotations.

(Inherited from SyntaxNode)
ContainsDiagnostics

Determines whether this node or any of its descendant nodes, tokens or trivia have any diagnostics on them.

(Inherited from SyntaxNode)
ContainsDirectives

Determines whether this node has any descendant preprocessor directives.

(Inherited from SyntaxNode)
ContainsSkippedText

Determines whether this node has any descendant skipped text.

(Inherited from SyntaxNode)
FullSpan

The absolute span of this node in characters, including its leading and trailing trivia.

(Inherited from SyntaxNode)
HasLeadingTrivia

Determines whether this node has any leading trivia.

(Inherited from SyntaxNode)
HasStructuredTrivia

Determines whether a descendant trivia of this node is structured.

(Inherited from SyntaxNode)
HasTrailingTrivia

Determines whether this node has any trailing trivia.

(Inherited from SyntaxNode)
IsMissing

Determines whether the node represents a language construct that was actually parsed from the source code. Missing nodes are generated by the parser in error scenarios to represent constructs that should have been present in the source code in order to compile successfully but were actually missing.

(Inherited from SyntaxNode)
IsStructuredTrivia

Determines whether this node represents a structured trivia.

(Inherited from SyntaxNode)
KindText (Inherited from SyntaxNode)
Language

The language name that this node is syntax of.

(Inherited from CSharpSyntaxNode)
Parent

The node that contains this node in its ChildNodes() collection.

(Inherited from SyntaxNode)
ParentTrivia (Inherited from SyntaxNode)
RawKind

An integer representing the language specific kind of this node.

(Inherited from SyntaxNode)
Span

The absolute span of this node in characters, not including its leading and trailing trivia.

(Inherited from SyntaxNode)
SpanStart

Same as accessing Start on Span.

(Inherited from SyntaxNode)
SyntaxTree

Returns SyntaxTree that owns the node.

(Inherited from SyntaxNode)
SyntaxTreeCore (Inherited from CSharpSyntaxNode)

Methods

Accept(CSharpSyntaxVisitor) (Inherited from CSharpSyntaxNode)
Accept<TResult>(CSharpSyntaxVisitor<TResult>) (Inherited from CSharpSyntaxNode)
Ancestors(Boolean)

Gets a list of ancestor nodes

(Inherited from SyntaxNode)
AncestorsAndSelf(Boolean)

Gets a list of ancestor nodes (including this node)

(Inherited from SyntaxNode)
ChildNodes()

Gets a list of the child nodes in prefix document order.

(Inherited from SyntaxNode)
ChildNodesAndTokens()

The list of child nodes and tokens of this node, where each element is a SyntaxNodeOrToken instance.

(Inherited from SyntaxNode)
ChildThatContainsPosition(Int32) (Inherited from SyntaxNode)
ChildTokens()

Gets a list of the direct child tokens of this node.

(Inherited from SyntaxNode)
Contains(SyntaxNode)

Determines if the specified node is a descendant of this node. Returns true for current node.

(Inherited from SyntaxNode)
ContainsDirective(Int32)

Returns true if this node contains any directives (e.g. #if, #nullable, etc.) within it with a matching kind.

(Inherited from SyntaxNode)
CopyAnnotationsTo<T>(T)

Copies all SyntaxAnnotations, if any, from this SyntaxNode instance and attaches them to a new instance based on node.

(Inherited from SyntaxNode)
DescendantNodes(Func<SyntaxNode,Boolean>, Boolean)

Gets a list of descendant nodes in prefix document order.

(Inherited from SyntaxNode)
DescendantNodes(TextSpan, Func<SyntaxNode,Boolean>, Boolean)

Gets a list of descendant nodes in prefix document order.

(Inherited from SyntaxNode)
DescendantNodesAndSelf(Func<SyntaxNode,Boolean>, Boolean)

Gets a list of descendant nodes (including this node) in prefix document order.

(Inherited from SyntaxNode)
DescendantNodesAndSelf(TextSpan, Func<SyntaxNode,Boolean>, Boolean)

Gets a list of descendant nodes (including this node) in prefix document order.

(Inherited from SyntaxNode)
DescendantNodesAndTokens(Func<SyntaxNode,Boolean>, Boolean)

Gets a list of descendant nodes and tokens in prefix document order.

(Inherited from SyntaxNode)
DescendantNodesAndTokens(TextSpan, Func<SyntaxNode,Boolean>, Boolean)

Gets a list of the descendant nodes and tokens in prefix document order.

(Inherited from SyntaxNode)
DescendantNodesAndTokensAndSelf(Func<SyntaxNode,Boolean>, Boolean)

Gets a list of descendant nodes and tokens (including this node) in prefix document order.

(Inherited from SyntaxNode)
DescendantNodesAndTokensAndSelf(TextSpan, Func<SyntaxNode,Boolean>, Boolean)

Gets a list of the descendant nodes and tokens (including this node) in prefix document order.

(Inherited from SyntaxNode)
DescendantTokens(Func<SyntaxNode,Boolean>, Boolean)

Gets a list of all the tokens in the span of this node.

(Inherited from SyntaxNode)
DescendantTokens(TextSpan, Func<SyntaxNode,Boolean>, Boolean)

Gets a list of all the tokens in the full span of this node.

(Inherited from SyntaxNode)
DescendantTrivia(Func<SyntaxNode,Boolean>, Boolean)

Get a list of all the trivia associated with the descendant nodes and tokens.

(Inherited from SyntaxNode)
DescendantTrivia(TextSpan, Func<SyntaxNode,Boolean>, Boolean)

Get a list of all the trivia associated with the descendant nodes and tokens.

(Inherited from SyntaxNode)
EquivalentToCore(SyntaxNode)

Determine if this node is structurally equivalent to another.

(Inherited from CSharpSyntaxNode)
FindNode(TextSpan, Boolean, Boolean)

Finds the node with the smallest FullSpan that contains span. getInnermostNodeForTie is used to determine the behavior in case of a tie (i.e. a node having the same span as its parent). If getInnermostNodeForTie is true, then it returns lowest descending node encompassing the given span. Otherwise, it returns the outermost node encompassing the given span.

(Inherited from SyntaxNode)
FindToken(Int32, Boolean)

Finds a token according to the following rules:

  1. If position matches the End of the node/s FullSpan and the node is CompilationUnit, then EoF is returned.

  2. If node.FullSpan.Contains(position) then the token that contains given position is returned.

  3. Otherwise an ArgumentOutOfRangeException is thrown

(Inherited from CSharpSyntaxNode)
FindTokenCore(Int32, Boolean)

Finds a descendant token of this node whose span includes the supplied position.

(Inherited from SyntaxNode)
FindTokenCore(Int32, Func<SyntaxTrivia,Boolean>)

Finds a descendant token of this node whose span includes the supplied position.

(Inherited from SyntaxNode)
FindTrivia(Int32, Boolean)

Finds a descendant trivia of this node whose span includes the supplied position.

(Inherited from CSharpSyntaxNode)
FindTrivia(Int32, Func<SyntaxTrivia,Boolean>)

Finds a descendant trivia of this node at the specified position, where the position is within the span of the node.

(Inherited from CSharpSyntaxNode)
FindTriviaCore(Int32, Boolean)

Finds a descendant trivia of this node whose span includes the supplied position.

(Inherited from SyntaxNode)
FirstAncestorOrSelf<TNode,TArg>(Func<TNode,TArg,Boolean>, TArg, Boolean)

Gets the first node of type TNode that matches the predicate.

(Inherited from SyntaxNode)
FirstAncestorOrSelf<TNode>(Func<TNode,Boolean>, Boolean)

Gets the first node of type TNode that matches the predicate.

(Inherited from SyntaxNode)
GetAnnotatedNodes(String)

Gets all nodes with the specified annotation kind.

(Inherited from SyntaxNode)
GetAnnotatedNodes(SyntaxAnnotation)

Gets all nodes with the specified annotation.

(Inherited from SyntaxNode)
GetAnnotatedNodesAndTokens(String)

Gets all nodes and tokens with an annotation of the specified annotation kind.

(Inherited from SyntaxNode)
GetAnnotatedNodesAndTokens(String[])

Gets all nodes and tokens with an annotation of the specified annotation kinds.

(Inherited from SyntaxNode)
GetAnnotatedNodesAndTokens(SyntaxAnnotation)

Gets all nodes and tokens with the specified annotation.

(Inherited from SyntaxNode)
GetAnnotatedTokens(String)

Gets all tokens with the specified annotation kind.

(Inherited from SyntaxNode)
GetAnnotatedTokens(SyntaxAnnotation)

Gets all tokens with the specified annotation.

(Inherited from SyntaxNode)
GetAnnotatedTrivia(String)

Gets all trivia with an annotation of the specified annotation kind.

(Inherited from SyntaxNode)
GetAnnotatedTrivia(String[])

Gets all trivia with an annotation of the specified annotation kinds.

(Inherited from SyntaxNode)
GetAnnotatedTrivia(SyntaxAnnotation)

Gets all trivia with the specified annotation.

(Inherited from SyntaxNode)
GetAnnotations(IEnumerable<String>)

Gets all the annotations with the specified annotation kinds.

(Inherited from SyntaxNode)
GetAnnotations(String)

Gets all the annotations with the specified annotation kind.

(Inherited from SyntaxNode)
GetDiagnostics()

Gets a list of all the diagnostics in the sub tree that has this node as its root. This method does not filter diagnostics based on #pragmas and compiler options like nowarn, warnaserror etc.

(Inherited from CSharpSyntaxNode)
GetFirstDirective(Func<DirectiveTriviaSyntax,Boolean>)

Gets the first directive of the tree rooted by this node.

(Inherited from CSharpSyntaxNode)
GetFirstToken(Boolean, Boolean, Boolean, Boolean)

Gets the first token of the tree rooted by this node.

(Inherited from CSharpSyntaxNode)
GetLastDirective(Func<DirectiveTriviaSyntax,Boolean>)

Gets the last directive of the tree rooted by this node.

(Inherited from CSharpSyntaxNode)
GetLastToken(Boolean, Boolean, Boolean, Boolean)

Gets the last non-zero-width token of the tree rooted by this node.

(Inherited from CSharpSyntaxNode)
GetLeadingTrivia()

The list of trivia that appears before this node in the source code.

(Inherited from CSharpSyntaxNode)
GetLocation()

Gets a Location for this node.

(Inherited from CSharpSyntaxNode)
GetRed<T>(T, Int32) (Inherited from SyntaxNode)
GetRedAtZero<T>(T) (Inherited from SyntaxNode)
GetReference()

Gets a SyntaxReference for this syntax node. CommonSyntaxReferences can be used to regain access to a syntax node without keeping the entire tree and source text in memory.

(Inherited from SyntaxNode)
GetText(Encoding, SourceHashAlgorithm)

Gets the full text of this node as a new SourceText instance.

(Inherited from SyntaxNode)
GetTrailingTrivia()

The list of trivia that appears after this node in the source code.

(Inherited from CSharpSyntaxNode)
HasAnnotation(SyntaxAnnotation)

Determines whether this node has the specific annotation.

(Inherited from SyntaxNode)
HasAnnotations(IEnumerable<String>)

Determines whether this node has any annotations with any of the specific annotation kinds.

(Inherited from SyntaxNode)
HasAnnotations(String)

Determines whether this node has any annotations with the specific annotation kind.

(Inherited from SyntaxNode)
InsertNodesInListCore(SyntaxNode, IEnumerable<SyntaxNode>, Boolean) (Inherited from CSharpSyntaxNode)
InsertTokensInListCore(SyntaxToken, IEnumerable<SyntaxToken>, Boolean) (Inherited from CSharpSyntaxNode)
InsertTriviaInListCore(SyntaxTrivia, IEnumerable<SyntaxTrivia>, Boolean) (Inherited from CSharpSyntaxNode)
IsEquivalentTo(SyntaxNode, Boolean)

Determines if two nodes are the same, disregarding trivia differences.

(Inherited from SyntaxNode)
IsEquivalentTo(SyntaxNode)

Determine whether this node is structurally equivalent to another.

(Inherited from SyntaxNode)
IsEquivalentToCore(SyntaxNode, Boolean) (Inherited from CSharpSyntaxNode)
IsIncrementallyIdenticalTo(SyntaxNode)

Returns true if these two nodes are considered "incrementally identical". An incrementally identical node occurs when a SyntaxTree is incrementally parsed using WithChangedText(SourceText) and the incremental parser is able to take the node from the original tree and use it in its entirety in the new tree. In this case, the ToFullString() of each node will be the same, though they could have different parents, and may occur at different positions in their respective trees. If two nodes are incrementally identical, all children of each node will be incrementally identical as well.

(Inherited from SyntaxNode)
IsPartOfStructuredTrivia()

Determines whether this node is a descendant of a structured trivia.

(Inherited from SyntaxNode)
Kind()

Returns the SyntaxKind of the node.

(Inherited from CSharpSyntaxNode)
NormalizeWhitespaceCore(String, String, Boolean) (Inherited from CSharpSyntaxNode)
RemoveNodesCore(IEnumerable<SyntaxNode>, SyntaxRemoveOptions) (Inherited from CSharpSyntaxNode)
ReplaceCore<TNode>(IEnumerable<TNode>, Func<TNode,TNode,SyntaxNode>, IEnumerable<SyntaxToken>, Func<SyntaxToken,SyntaxToken,SyntaxToken>, IEnumerable<SyntaxTrivia>, Func<SyntaxTrivia,SyntaxTrivia,SyntaxTrivia>) (Inherited from CSharpSyntaxNode)
ReplaceNodeInListCore(SyntaxNode, IEnumerable<SyntaxNode>) (Inherited from CSharpSyntaxNode)
ReplaceTokenInListCore(SyntaxToken, IEnumerable<SyntaxToken>) (Inherited from CSharpSyntaxNode)
ReplaceTriviaInListCore(SyntaxTrivia, IEnumerable<SyntaxTrivia>) (Inherited from CSharpSyntaxNode)
SerializeTo(Stream, CancellationToken)
Obsolete.
Obsolete.

Serializes the node to the given stream. Leaves the stream open for further writes.

(Inherited from SyntaxNode)
ToFullString()

Returns full string representation of this node including its leading and trailing trivia.

(Inherited from SyntaxNode)
ToString()

Returns the string representation of this node, not including its leading and trailing trivia.

(Inherited from SyntaxNode)
WriteTo(TextWriter)

Writes the full text of this node to the specified TextWriter.

(Inherited from SyntaxNode)

Explicit Interface Implementations

IFormattable.ToString(String, IFormatProvider) (Inherited from CSharpSyntaxNode)

Extension Methods

GetFirstDirective(SyntaxNode, Func<DirectiveTriviaSyntax,Boolean>)

Gets the first directive of the tree rooted by this node.

GetLastDirective(SyntaxNode, Func<DirectiveTriviaSyntax,Boolean>)

Gets the last directive of the tree rooted by this node.

Kind(SyntaxNode)

Returns SyntaxKind for SyntaxNode from RawKind property.

TryGetInferredMemberName(SyntaxNode)

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

ContainsDirective(SyntaxNode, SyntaxKind)

Returns true if this node contains any directives (e.g. #if, #nullable, etc.) within it with a matching kind.

IsKind(SyntaxNode, SyntaxKind)

Determines if SyntaxNode is of a specified kind.

GetCurrentNode<TNode>(SyntaxNode, TNode)

Gets the node within the subtree corresponding to the original tracked node. Use TrackNodes to start tracking nodes.

GetCurrentNodes<TNode>(SyntaxNode, TNode)

Gets the nodes within the subtree corresponding to the original tracked node. Use TrackNodes to start tracking nodes.

GetCurrentNodes<TNode>(SyntaxNode, IEnumerable<TNode>)

Gets the nodes within the subtree corresponding to the original tracked nodes. Use TrackNodes to start tracking nodes.

TryGetInferredMemberName(SyntaxNode)

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

GetDirectives(SyntaxNode, Func<DirectiveTriviaSyntax,Boolean>)

Gets the DirectiveTriviaSyntax items for a specified SyntaxNode with optional filtering.

GetFirstDirective(SyntaxNode, Func<DirectiveTriviaSyntax,Boolean>)

Gets the first DirectiveTriviaSyntax item for a specified SyntaxNode.

GetLastDirective(SyntaxNode, Func<DirectiveTriviaSyntax,Boolean>)

Gets the last DirectiveTriviaSyntax item for a specified SyntaxNode.

Kind(SyntaxNode)

Returns SyntaxKind for SyntaxNode from RawKind property.

ContainsDirective(SyntaxNode, SyntaxKind)

Returns true if this node contains any directives (e.g. #if, #nullable, etc.) within it with a matching kind.

IsKind(SyntaxNode, SyntaxKind)

Determines if SyntaxNode is of a specified kind.

Applies to