Search Results for

    Show / Hide Table of Contents

    Struct SyntaxTriviaList

    Represents a read-only list of SyntaxTrivia.

    Implements
    IEquatable<SyntaxTriviaList>
    IReadOnlyList<SyntaxTrivia>
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    Namespace: Loretta.CodeAnalysis
    Assembly: cs.temp.dll.dll
    Syntax
    public readonly struct SyntaxTriviaList

    Constructors

    SyntaxTriviaList(SyntaxTrivia)

    Creates a new trivia list with the provided trivia as the only element.

    Declaration
    public SyntaxTriviaList(SyntaxTrivia trivia)
    Parameters
    Type Name Description
    SyntaxTrivia trivia

    SyntaxTriviaList(SyntaxTrivia[])

    Creates a list of trivia.

    Declaration
    public SyntaxTriviaList(params SyntaxTrivia[] trivias)
    Parameters
    Type Name Description
    SyntaxTrivia[] trivias

    An array of trivia.

    SyntaxTriviaList(Nullable<IEnumerable<SyntaxTrivia>>)

    Creates a list of trivia.

    Declaration
    public SyntaxTriviaList(IEnumerable<SyntaxTrivia>? trivias)
    Parameters
    Type Name Description
    System.Nullable<IEnumerable<SyntaxTrivia>> trivias

    A sequence of trivia.

    Properties

    Count

    The amount of elements in this list.

    Declaration
    public readonly int Count { get; }
    Property Value
    Type Description
    System.Int32

    Empty

    An empty trivia list.

    Declaration
    public static readonly SyntaxTriviaList Empty { get; }
    Property Value
    Type Description
    SyntaxTriviaList

    FullSpan

    The absolute span of the list elements in characters, including the leading and trailing trivia of the first and last elements.

    Declaration
    public readonly TextSpan FullSpan { get; }
    Property Value
    Type Description
    TextSpan

    Item[Int32]

    Gets the trivia at the specified index.

    Declaration
    public readonly SyntaxTrivia this[int index] { get; }
    Parameters
    Type Name Description
    System.Int32 index

    The zero-based index of the trivia to get.

    Property Value
    Type Description
    SyntaxTrivia

    The token at the specified index.

    Span

    The absolute span of the list elements in characters, not including the leading and trailing trivia of the first and last elements.

    Declaration
    public readonly TextSpan Span { get; }
    Property Value
    Type Description
    TextSpan

    Methods

    Add(SyntaxTrivia)

    Creates a new SyntaxTriviaList with the specified trivia added to the end.

    Declaration
    public readonly SyntaxTriviaList Add(SyntaxTrivia trivia)
    Parameters
    Type Name Description
    SyntaxTrivia trivia

    The trivia to add.

    Returns
    Type Description
    SyntaxTriviaList

    AddRange(IEnumerable<SyntaxTrivia>)

    Creates a new SyntaxTriviaList with the specified trivia added to the end.

    Declaration
    public readonly SyntaxTriviaList AddRange(IEnumerable<SyntaxTrivia> trivia)
    Parameters
    Type Name Description
    IEnumerable<SyntaxTrivia> trivia

    The trivia to add.

    Returns
    Type Description
    SyntaxTriviaList

    Any()

    Does this list have any items.

    Declaration
    public readonly bool Any()
    Returns
    Type Description
    System.Boolean

    Create(SyntaxTrivia)

    Creates a new trivia list.

    Declaration
    public static SyntaxTriviaList Create(SyntaxTrivia trivia)
    Parameters
    Type Name Description
    SyntaxTrivia trivia
    Returns
    Type Description
    SyntaxTriviaList

    ElementAt(Int32)

    Returns the element at the provided index.

    Declaration
    public readonly SyntaxTrivia ElementAt(int index)
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type Description
    SyntaxTrivia

    Equals(SyntaxTriviaList)

    Declaration
    public readonly bool Equals(SyntaxTriviaList other)
    Parameters
    Type Name Description
    SyntaxTriviaList other
    Returns
    Type Description
    System.Boolean

    Equals(Object)

    Declaration
    public override readonly bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.ValueType.Equals(System.Object)

    First()

    Returns the first trivia in the list.

    Declaration
    public readonly SyntaxTrivia First()
    Returns
    Type Description
    SyntaxTrivia

    The first trivia in the list.

    GetEnumerator()

    Returns the enumerator for this list.

    Declaration
    public readonly SyntaxTriviaList.Enumerator GetEnumerator()
    Returns
    Type Description
    SyntaxTriviaList.Enumerator

    GetHashCode()

    Declaration
    public override readonly int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.ValueType.GetHashCode()

    IndexOf(SyntaxTrivia)

    Returns the index of the provided trivia in this list.

    Declaration
    public readonly int IndexOf(SyntaxTrivia triviaInList)
    Parameters
    Type Name Description
    SyntaxTrivia triviaInList
    Returns
    Type Description
    System.Int32

    -1 if not found.

    Insert(Int32, SyntaxTrivia)

    Creates a new SyntaxTriviaList with the specified trivia inserted at the index.

    Declaration
    public readonly SyntaxTriviaList Insert(int index, SyntaxTrivia trivia)
    Parameters
    Type Name Description
    System.Int32 index

    The index in the list to insert the trivia at.

    SyntaxTrivia trivia

    The trivia to insert.

    Returns
    Type Description
    SyntaxTriviaList

    InsertRange(Int32, IEnumerable<SyntaxTrivia>)

    Creates a new SyntaxTriviaList with the specified trivia inserted at the index.

    Declaration
    public readonly SyntaxTriviaList InsertRange(int index, IEnumerable<SyntaxTrivia> trivia)
    Parameters
    Type Name Description
    System.Int32 index

    The index in the list to insert the trivia at.

    IEnumerable<SyntaxTrivia> trivia

    The trivia to insert.

    Returns
    Type Description
    SyntaxTriviaList

    Last()

    Returns the last trivia in the list.

    Declaration
    public readonly SyntaxTrivia Last()
    Returns
    Type Description
    SyntaxTrivia

    The last trivia in the list.

    Remove(SyntaxTrivia)

    Creates a new SyntaxTriviaList with the specified element removed.

    Declaration
    public readonly SyntaxTriviaList Remove(SyntaxTrivia triviaInList)
    Parameters
    Type Name Description
    SyntaxTrivia triviaInList

    The trivia element to remove.

    Returns
    Type Description
    SyntaxTriviaList

    RemoveAt(Int32)

    Creates a new SyntaxTriviaList with the element at the specified index removed.

    Declaration
    public readonly SyntaxTriviaList RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The index identifying the element to remove.

    Returns
    Type Description
    SyntaxTriviaList

    Replace(SyntaxTrivia, SyntaxTrivia)

    Creates a new SyntaxTriviaList with the specified element replaced with new trivia.

    Declaration
    public readonly SyntaxTriviaList Replace(SyntaxTrivia triviaInList, SyntaxTrivia newTrivia)
    Parameters
    Type Name Description
    SyntaxTrivia triviaInList

    The trivia element to replace.

    SyntaxTrivia newTrivia

    The trivia to replace the element with.

    Returns
    Type Description
    SyntaxTriviaList

    ReplaceRange(SyntaxTrivia, IEnumerable<SyntaxTrivia>)

    Creates a new SyntaxTriviaList with the specified element replaced with new trivia.

    Declaration
    public readonly SyntaxTriviaList ReplaceRange(SyntaxTrivia triviaInList, IEnumerable<SyntaxTrivia> newTrivia)
    Parameters
    Type Name Description
    SyntaxTrivia triviaInList

    The trivia element to replace.

    IEnumerable<SyntaxTrivia> newTrivia

    The trivia to replace the element with.

    Returns
    Type Description
    SyntaxTriviaList

    Reverse()

    Returns a list which contains all elements of SyntaxTriviaList in reversed order.

    Declaration
    public readonly SyntaxTriviaList.Reversed Reverse()
    Returns
    Type Description
    SyntaxTriviaList.Reversed

    SyntaxTriviaList.Reversed which contains all elements of SyntaxTriviaList in reversed order

    ToFullString()

    Returns the list as a string including leading and trailing trivia.

    Declaration
    public readonly string ToFullString()
    Returns
    Type Description
    System.String

    ToString()

    Declaration
    public override readonly string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.ValueType.ToString()

    Operators

    Equality(SyntaxTriviaList, SyntaxTriviaList)

    Checks whether two trivia lists are equal.

    Declaration
    public static bool operator ==(SyntaxTriviaList left, SyntaxTriviaList right)
    Parameters
    Type Name Description
    SyntaxTriviaList left
    SyntaxTriviaList right
    Returns
    Type Description
    System.Boolean

    Inequality(SyntaxTriviaList, SyntaxTriviaList)

    Checks whether two trivia lists are not equal.

    Declaration
    public static bool operator !=(SyntaxTriviaList left, SyntaxTriviaList right)
    Parameters
    Type Name Description
    SyntaxTriviaList left
    SyntaxTriviaList right
    Returns
    Type Description
    System.Boolean

    Implements

    IEquatable<>
    IReadOnlyList<>
    ☀
    ☾
    In This Article
    Back to top

    Copyright (c) LorettaDevs

    Generated by DocFX

    ☀
    ☾