Struct SyntaxNodeId
Represents an identifier that is unique for every node of an AST.
public readonly record struct SyntaxNodeId : IEquatable<SyntaxNodeId>, IComparable<SyntaxNodeId>
- Implements
- Inherited Members
Remarks
Encodes the node's position within the AST.
Constructors
SyntaxNodeId(string, ImmutableArray<int>)
Represents an identifier that is unique for every node of an AST.
public SyntaxNodeId(string DocumentUri, ImmutableArray<int> Lineage)
Parameters
DocumentUristringThe URI of the document this syntax tree belongs to.
LineageImmutableArray<int>An array of successive child index values in the syntax tree.
Remarks
Encodes the node's position within the AST.
Properties
DocumentUri
The URI of the document this syntax tree belongs to.
public string DocumentUri { get; init; }
Property Value
Lineage
An array of successive child index values in the syntax tree.
public ImmutableArray<int> Lineage { get; init; }
Property Value
Methods
Add(int)
public SyntaxNodeId Add(int position)
Parameters
positionint
Returns
CompareTo(SyntaxNodeId)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(SyntaxNodeId other)
Parameters
otherSyntaxNodeIdAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
Equals(SyntaxNodeId)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(SyntaxNodeId other)
Parameters
otherSyntaxNodeIdAn object to compare with this object.
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.