Table of Contents

Struct SourceRange

Namespace
RDCore.SDK.Model.Source
Assembly
RDCore.SDK.dll

A contiguous span in a source document, from a Start position (inclusive) to an End position (exclusive).

public readonly record struct SourceRange : IComparable<SourceRange>, IEquatable<SourceRange>
Implements
Inherited Members
Extension Methods

Remarks

IComparable compares source location start.

Constructors

SourceRange(SourcePosition, SourcePosition)

A contiguous span in a source document, from a Start position (inclusive) to an End position (exclusive).

public SourceRange(SourcePosition Start, SourcePosition End)

Parameters

Start SourcePosition

The inclusive start position of the range.

End SourcePosition

The exclusive end position of the range.

Remarks

IComparable compares source location start.

SourceRange(int, int, int, int)

Creates a SourceRange from zero-based start/end line numbers and character offsets.

public SourceRange(int startLine, int startCharacter, int endLine, int endCharacter)

Parameters

startLine int
startCharacter int
endLine int
endCharacter int

Properties

Empty

Gets an empty range at position L0C0.

public static SourceRange Empty { get; }

Property Value

SourceRange

End

The exclusive end position of the range.

public SourcePosition End { get; init; }

Property Value

SourcePosition

IsEmpty

true if this range spans no characters (Start and End are the same position).

public bool IsEmpty { get; }

Property Value

bool

Start

The inclusive start position of the range.

public SourcePosition Start { get; init; }

Property Value

SourcePosition

Methods

CompareTo(SourceRange)

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(SourceRange other)

Parameters

other SourceRange

An 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 other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.