SyntaxList<TNode> Struct
A sequence of nodes of the same kind, held in one slot of their parent.
public readonly struct SyntaxList<TNode> : IEnumerable<TNode>, IReadOnlyCollection<TNode>, IReadOnlyList<TNode>, IEnumerable, IEquatable<SyntaxList<TNode>> where TNode : SyntaxNodeType parameters
TNode- The type of the nodes in the list.
Remarks
default is the empty list.
- Implements
Nested types
| Name | Description |
|---|---|
| SyntaxList<TNode>.Enumerator | Walks a SyntaxList<TNode> without allocating. |
Constructors
| Name | Description |
|---|---|
| SyntaxList(IEnumerable<TNode>) | Creates a detached list holding nodes. |
| SyntaxList(TNode?) | Creates a detached list holding a single node. |
SyntaxList overloads
SyntaxList(IEnumerable<TNode>)
SyntaxList.csCreates a detached list holding nodes.
public SyntaxList(IEnumerable<TNode> nodes)SyntaxList(TNode?)
SyntaxList.csCreates a detached list holding a single node.
public SyntaxList(TNode? node)Parameters
nodeTNode?
Properties
| Name | Description |
|---|---|
| Count | |
| FullSpan | |
| Span |
Count
SyntaxList.csFullSpan
SyntaxList.csSpan
SyntaxList.csIndexers
| Name | Description |
|---|---|
| this[int] |
this[int]
SyntaxList.csMethods
| Name | Description |
|---|---|
| Add(TNode) | Returns a detached list with node appended. |
| AddRange(IEnumerable<TNode>) | Returns a detached list with nodes appended. |
| Any() | |
| Equals(SyntaxList<TNode>) | |
| Equals(object?) | |
| First() | |
| FirstOrDefault() | |
| GetEnumerator() | |
| GetHashCode() | |
| IndexOf(Func<TNode, bool>) | Finds the first node matching predicate, or -1. |
| IndexOf(TNode) | Returns the position of node in this list, or -1. |
| Insert(int, TNode) | Returns a detached list with node inserted at index. |
| InsertRange(int, IEnumerable<TNode>) | Returns a detached list with nodes inserted at index. |
| Last() | |
| LastOrDefault() | |
| Remove(TNode) | Returns a detached list without node, or this list when it does not contain it. |
| RemoveAt(int) | Returns a detached list without the node at index. |
| Replace(TNode, TNode) | Returns a detached list with newNode in place of nodeInList. |
| ReplaceRange(TNode, IEnumerable<TNode>) | Returns a detached list with newNodes in place of nodeInList. |
| System.Collections.Generic.IEnumerable<TNode>.GetEnumerator() | |
| System.Collections.IEnumerable.GetEnumerator() | |
| ToFullString() | |
| ToString() |
Add(TNode)
SyntaxList.csReturns a detached list with node appended.
public SyntaxList<TNode> Add(TNode node)AddRange(IEnumerable<TNode>)
SyntaxList.csReturns a detached list with nodes appended.
public SyntaxList<TNode> AddRange(IEnumerable<TNode> nodes)Any()
SyntaxList.csEquals overloads
Equals(SyntaxList<TNode>)
SyntaxList.cspublic bool Equals(SyntaxList<TNode> other)No documentation is available.
Equals(object?)
SyntaxList.csFirst()
SyntaxList.cspublic TNode? First()Returns
TNode?
No documentation is available.
FirstOrDefault()
SyntaxList.cspublic TNode? FirstOrDefault()Returns
TNode?
No documentation is available.
GetEnumerator()
SyntaxList.csGetHashCode()
SyntaxList.csIndexOf overloads
IndexOf(Func<TNode, bool>)
SyntaxList.csFinds the first node matching predicate, or -1.
IndexOf(TNode)
SyntaxList.csReturns the position of node in this list, or -1.
public int IndexOf(TNode node)Parameters
nodeTNode
Returns
Remarks
Elements are matched by which one they are, not by the immutable node behind them: that node is shared, so two elements holding the same text are usually the same node and would both answer with the first position.
Insert(int, TNode)
SyntaxList.csReturns a detached list with node inserted at index.
public SyntaxList<TNode> Insert(int index, TNode node)InsertRange(int, IEnumerable<TNode>)
SyntaxList.csReturns a detached list with nodes inserted at index.
public SyntaxList<TNode> InsertRange(int index, IEnumerable<TNode> nodes)Last()
SyntaxList.cspublic TNode? Last()Returns
TNode?
No documentation is available.
LastOrDefault()
SyntaxList.cspublic TNode? LastOrDefault()Returns
TNode?
No documentation is available.
Remove(TNode)
SyntaxList.csReturns a detached list without node, or this list when it does not contain it.
public SyntaxList<TNode> Remove(TNode node)RemoveAt(int)
SyntaxList.csReturns a detached list without the node at index.
public SyntaxList<TNode> RemoveAt(int index)Replace(TNode, TNode)
SyntaxList.csReturns a detached list with newNode in place of nodeInList.
public SyntaxList<TNode> Replace(TNode nodeInList, TNode newNode)Parameters
nodeInListTNodenewNodeTNode
Returns
Exceptions
ArgumentNullExceptionnewNodeisnull.ArgumentExceptionnodeInListis not in this list.
ReplaceRange(TNode, IEnumerable<TNode>)
SyntaxList.csReturns a detached list with newNodes in place of nodeInList.
public SyntaxList<TNode> ReplaceRange(TNode nodeInList, IEnumerable<TNode> newNodes)Parameters
nodeInListTNodenewNodesIEnumerable<TNode>
Returns
Exceptions
ArgumentNullExceptionnewNodesisnull.ArgumentExceptionnodeInListis not in this list.
System.Collections.Generic.IEnumerable<TNode>.GetEnumerator()
SyntaxList.csSystem.Collections.IEnumerable.GetEnumerator()
SyntaxList.csToFullString()
SyntaxList.csToString()
SyntaxList.csOperators
| Name | Description |
|---|---|
| operator ==(SyntaxList<TNode>, SyntaxList<TNode>) | |
| implicit operator SyntaxList<SyntaxNode>(SyntaxList<TNode>) | |
| operator !=(SyntaxList<TNode>, SyntaxList<TNode>) |
operator ==(SyntaxList<TNode>, SyntaxList<TNode>)
SyntaxList.cspublic static bool operator ==(SyntaxList<TNode> left, SyntaxList<TNode> right)No documentation is available.
implicit operator SyntaxList<SyntaxNode>(SyntaxList<TNode>)
SyntaxList.cspublic static implicit operator SyntaxList<SyntaxNode>(SyntaxList<TNode> nodes)No documentation is available.
operator !=(SyntaxList<TNode>, SyntaxList<TNode>)
SyntaxList.cspublic static bool operator !=(SyntaxList<TNode> left, SyntaxList<TNode> right)No documentation is available.