Struct SyntaxList<TNode>
Implements
IReadOnlyList<TNode>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Loretta.CodeAnalysis.dll
Syntax
public readonly struct SyntaxList<TNode>
where TNode : SyntaxNode
Type Parameters
Constructors
|
Improve this Doc
View Source
SyntaxList(TNode)
Creates a singleton list of syntax nodes.
Declaration
public SyntaxList(TNode node)
Parameters
Type |
Name |
Description |
TNode |
node |
The single element node.
|
|
Improve this Doc
View Source
SyntaxList(Nullable<IEnumerable<TNode>>)
Creates a list of syntax nodes.
Declaration
public SyntaxList(IEnumerable<TNode>? nodes)
Parameters
Type |
Name |
Description |
System.Nullable<System.Collections.IEnumerable<TNode>> |
nodes |
A sequence of element nodes.
|
Properties
|
Improve this Doc
View Source
Count
The number of nodes in the list.
Declaration
public readonly int Count { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
Item[Int32]
Gets the node at the specified index.
Declaration
public readonly TNode this[int index] { get; }
Parameters
Type |
Name |
Description |
System.Int32 |
index |
The zero-based index of the node to get or set.
|
Property Value
Type |
Description |
TNode |
The node at the specified index.
|
|
Improve this Doc
View Source
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
Methods
|
Improve this Doc
View Source
Add(TNode)
Creates a new list with the specified node added at the end.
Declaration
public readonly SyntaxList<TNode> Add(TNode node)
Parameters
Type |
Name |
Description |
TNode |
node |
The node to add.
|
Returns
|
Improve this Doc
View Source
AddRange(IEnumerable<TNode>)
Creates a new list with the specified nodes added at the end.
Declaration
public readonly SyntaxList<TNode> AddRange(IEnumerable<TNode> nodes)
Parameters
Type |
Name |
Description |
System.Collections.IEnumerable<TNode> |
nodes |
The nodes to add.
|
Returns
|
Improve this Doc
View Source
Any()
True if the list has at least one node.
Declaration
public readonly bool Any()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Equals(SyntaxList<TNode>)
Declaration
public readonly bool Equals(SyntaxList<TNode> other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
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)
|
Improve this Doc
View Source
First()
The first node in the list.
Declaration
public readonly TNode First()
Returns
|
Improve this Doc
View Source
FirstOrDefault()
The first node in the list or default if the list is empty.
Declaration
public readonly TNode FirstOrDefault()
Returns
|
Improve this Doc
View Source
GetEnumerator()
Gets the enumerator for this list.
Declaration
public readonly SyntaxList<TNode>.Enumerator GetEnumerator()
Returns
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
|
Improve this Doc
View Source
IndexOf(TNode)
The index of the node in this list, or -1 if the node is not in the list.
Declaration
public readonly int IndexOf(TNode node)
Parameters
Type |
Name |
Description |
TNode |
node |
|
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
IndexOf(Func<TNode, Boolean>)
Returns the index of the first node in this list that passes the provided predicate.
Declaration
public readonly int IndexOf(Func<TNode, bool> predicate)
Parameters
Type |
Name |
Description |
Func<TNode, System.Boolean> |
predicate |
|
Returns
Type |
Description |
System.Int32 |
-1 if not found.
|
|
Improve this Doc
View Source
Insert(Int32, TNode)
Creates a new list with the specified node inserted at the index.
Declaration
public readonly SyntaxList<TNode> Insert(int index, TNode node)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
The index to insert at.
|
TNode |
node |
The node to insert.
|
Returns
|
Improve this Doc
View Source
InsertRange(Int32, IEnumerable<TNode>)
Creates a new list with the specified nodes inserted at the index.
Declaration
public readonly SyntaxList<TNode> InsertRange(int index, IEnumerable<TNode> nodes)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
The index to insert at.
|
System.Collections.IEnumerable<TNode> |
nodes |
The nodes to insert.
|
Returns
|
Improve this Doc
View Source
Last()
The last node in the list.
Declaration
public readonly TNode Last()
Returns
|
Improve this Doc
View Source
LastIndexOf(TNode)
Returns the index of the last item that is equal to the provided node in this list.
Declaration
public readonly int LastIndexOf(TNode node)
Parameters
Type |
Name |
Description |
TNode |
node |
|
Returns
Type |
Description |
System.Int32 |
-1 if not found.
|
|
Improve this Doc
View Source
LastIndexOf(Func<TNode, Boolean>)
Returns the index of the last node in this list that passes the provided predicate.
Declaration
public readonly int LastIndexOf(Func<TNode, bool> predicate)
Parameters
Type |
Name |
Description |
Func<TNode, System.Boolean> |
predicate |
|
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
LastOrDefault()
The last node in the list or default if the list is empty.
Declaration
public readonly TNode LastOrDefault()
Returns
|
Improve this Doc
View Source
Remove(TNode)
Creates a new list with the element removed.
Declaration
public readonly SyntaxList<TNode> Remove(TNode node)
Parameters
Type |
Name |
Description |
TNode |
node |
The element to remove.
|
Returns
|
Improve this Doc
View Source
RemoveAt(Int32)
Creates a new list with the element at specified index removed.
Declaration
public readonly SyntaxList<TNode> RemoveAt(int index)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
The index of the element to remove.
|
Returns
|
Improve this Doc
View Source
Replace(TNode, TNode)
Creates a new list with the specified element replaced with the new node.
Declaration
public readonly SyntaxList<TNode> Replace(TNode nodeInList, TNode newNode)
Parameters
Type |
Name |
Description |
TNode |
nodeInList |
The element to replace.
|
TNode |
newNode |
The new node.
|
Returns
|
Improve this Doc
View Source
ReplaceRange(TNode, IEnumerable<TNode>)
Creates a new list with the specified element replaced with new nodes.
Declaration
public readonly SyntaxList<TNode> ReplaceRange(TNode nodeInList, IEnumerable<TNode> newNodes)
Parameters
Type |
Name |
Description |
TNode |
nodeInList |
The element to replace.
|
System.Collections.IEnumerable<TNode> |
newNodes |
The new nodes.
|
Returns
|
Improve this Doc
View Source
ToFullString()
Returns the full string representation of the nodes in this list including
the first node's leading trivia and the last node's trailing trivia.
Declaration
public readonly string ToFullString()
Returns
Type |
Description |
System.String |
The full string representation of the nodes in this list including
the first node's leading trivia and the last node's trailing trivia.
|
|
Improve this Doc
View Source
ToString()
Returns the string representation of the nodes in this list, not including
the first node's leading trivia and the last node's trailing trivia.
Declaration
public override readonly string ToString()
Returns
Type |
Description |
System.String |
The string representation of the nodes in this list, not including
the first node's leading trivia and the last node's trailing trivia.
|
Overrides
System.ValueType.ToString()
Operators
|
Improve this Doc
View Source
Equality(SyntaxList<TNode>, SyntaxList<TNode>)
Checks whether two lists are equal.
Does a reference check instead of structural.
Declaration
public static bool operator ==(SyntaxList<TNode> left, SyntaxList<TNode> right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Implicit(SyntaxList<TNode> to SyntaxList<SyntaxNode>)
Converts a typed node list into an opaquely typed node list.
Declaration
public static implicit operator SyntaxList<SyntaxNode>(SyntaxList<TNode> nodes)
Parameters
Returns
|
Improve this Doc
View Source
Implicit(SyntaxList<SyntaxNode> to SyntaxList<TNode>)
Converts an opaquely typed node list into a typed node list.
Declaration
public static implicit operator SyntaxList<TNode>(SyntaxList<SyntaxNode> nodes)
Parameters
Returns
|
Improve this Doc
View Source
Inequality(SyntaxList<TNode>, SyntaxList<TNode>)
Checks whether two lists are not equal.
Does a reference check instead of structural.
Declaration
public static bool operator !=(SyntaxList<TNode> left, SyntaxList<TNode> right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Explicit Interface Implementations
|
Improve this Doc
View Source
IEnumerable.GetEnumerator()
Declaration
readonly IEnumerator IEnumerable.GetEnumerator()
Returns
Type |
Description |
System.Collections.IEnumerator |
|
Implements
IReadOnlyList<>
IEquatable<>
Extension Methods