Skip to main content

SyntaxTriviaList Struct Extensions

Extension MethodSummary
All(SyntaxTriviaList, Func<SyntaxTrivia, Boolean>)Returns true if all trivia in a SyntaxTriviaList matches the predicate.
Any(SyntaxTriviaList, Func<SyntaxTrivia, Boolean>)Returns true if any trivia in a SyntaxTriviaList matches the predicate.
Contains(SyntaxTriviaList, SyntaxKind)Returns true if a trivia of the specified kind is in the SyntaxTriviaList.
Find(SyntaxTriviaList, SyntaxKind)Searches for a trivia of the specified kind and returns the first occurrence within the entire SyntaxList<TNode>.
IndexOf(SyntaxTriviaList, Func<SyntaxTrivia, Boolean>)Searches for a trivia that matches the predicate and returns the zero-based index of the first occurrence within the entire SyntaxTriviaList.
IsEmptyOrWhitespace(SyntaxTriviaList)Returns true if the list of either empty or contains only whitespace (SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia).
LastIndexOf(SyntaxTriviaList, SyntaxKind)Searches for a trivia of the specified kind and returns the zero-based index of the last occurrence within the entire SyntaxTriviaList.
RemoveRange(SyntaxTriviaList, Int32, Int32)Creates a new list with trivia in the specified range removed.
ReplaceAt(SyntaxTriviaList, Int32, SyntaxTrivia)Creates a new SyntaxTriviaList with a trivia at the specified index replaced with new trivia.
ReplaceRange(SyntaxTriviaList, Int32, Int32, IEnumerable<SyntaxTrivia>)Creates a new list with the trivia in the specified range replaced with new trivia.