Click or drag to resize

SyntaxTrivia Class



Represents a trivia in the syntax tree. This is the language agnostic equivalent of SyntaxTrivia and SyntaxTrivia.
Inheritance Hierarchy
SystemValueType
  Microsoft.CodeAnalysisSyntaxTrivia

Namespace:  Microsoft.CodeAnalysis
Assembly:  Microsoft.CodeAnalysis (in Microsoft.CodeAnalysis.dll) Version: 2.3.0-dev-56735-00. Commit Hash: <developer build>
Syntax
public sealed class SyntaxTrivia : ValueType, 
	IEquatable

The SyntaxTrivia type exposes the following members.

Properties
  NameDescription
Public propertyContainsDiagnostics
Determines whether this trivia has any diagnostics on it. If this trivia is a structured trivia then the returned value will indicate whether this trivia or any of its descendant nodes, tokens or trivia have any diagnostics on them.
Public propertyFullSpan
The absolute span of this trivia in characters. If this trivia is a structured trivia then the returned span will include spans of any leading or trailing trivia present on the child non-terminal node of this trivia.
Public propertyHasStructure
Determines whether this trivia is a structured trivia.
Public propertyIsDirective
Determines whether this trivia represents a preprocessor directive.
Public propertyLanguage
The language name that this trivia is syntax of.
Public propertyRawKind
An integer representing the language specific kind of this trivia.
Public propertySpan
The absolute span of this trivia in characters. If this trivia is a structured trivia then the returned span will not include spans of any leading or trailing trivia present on the child non-terminal node of this trivia.
Public propertySpanStart
Same as accessing Start on Span.
Public propertySyntaxTree
SyntaxTree which contains current SyntaxTrivia.
Public propertyToken
The parent token that contains this token in its LeadingTrivia or TrailingTrivia collection.
Top
Methods
  NameDescription
Public methodCopyAnnotationsTo
Copies all SyntaxAnnotations, if any, from this SyntaxTrivia instance and attaches them to a new instance based on trivia.
Public methodEquals(Object)
Determines whether the supplied SyntaxTrivia is equal to this SyntaxTrivia.
Public methodEquals(SyntaxTrivia)
Determines whether the supplied SyntaxTrivia is equal to this SyntaxTrivia.
Public methodGetAnnotations(Void)
Public methodGetDiagnostics
Gets a list of all the diagnostics associated with this trivia. This method does not filter diagnostics based on #pragmas and compiler options like nowarn, warnaserror etc.
Public methodGetHashCode
Serves as hash function for SyntaxTrivia.
Public methodGetLocation
Get the location of this trivia.
Public methodGetStructure
Returns the child non-terminal node representing the syntax tree structure under this structured trivia.
Public methodHasAnnotation
Determines whether this trivia has the specific annotation.
Public methodHasAnnotations(String)
Determines where this trivia has annotations of the specified annotation kind.
Public methodHasAnnotations(String)
Determines where this trivia has any annotations of the specified annotation kinds.
Public methodIsEquivalentTo
Determines if this trivia is equivalent to the specified trivia.
Public methodIsPartOfStructuredTrivia
Determines whether this trivia is a descendant of a structured trivia.
Public methodToFullString
Returns the full string representation of this trivia. If this trivia is structured trivia then the returned string will include any leading or trailing trivia present on the StructuredTriviaSyntax node of this trivia.
Public methodToString
Returns the string representation of this trivia. If this trivia is structured trivia then the returned string will not include any leading or trailing trivia present on the StructuredTriviaSyntax node of this trivia.
Public methodWithAdditionalAnnotations(IEnumerableT)
Public methodWithAdditionalAnnotations(SyntaxAnnotation)
Creates a new SyntaxTrivia with the specified annotations.
Public methodWithoutAnnotations(IEnumerableT)
Public methodWithoutAnnotations(String)
Creates a new SyntaxTrivia without annotations of the specified kind.
Public methodWithoutAnnotations(SyntaxAnnotation)
Creates a new SyntaxTrivia without the specified annotations.
Public methodWriteTo
Writes the full text of this trivia to the specified TextWriter.
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Determines whether two SyntaxTrivias are equal.
Public operatorStatic memberInequality
Determines whether two SyntaxTrivias are unequal.
Top
Extension Methods
  NameDescription
Public Extension MethodIsKind(SyntaxKind)Overloaded.
Determines if SyntaxTrivia is a specified kind.
(Defined by VisualBasicExtensions.)
Public Extension MethodIsKind(SyntaxKind)Overloaded. (Defined by CSharpExtensions.)
Public Extension MethodKindOverloaded.
Returns SyntaxKind for SyntaxTrivia nodes.
(Defined by VisualBasicExtensions.)
Public Extension MethodKindOverloaded. (Defined by CSharpExtensions.)
Top
See Also