Table of Contents

Class IntRange

Namespace
Supabase.Postgrest
Assembly
Supabase.Postgrest.dll

Represent a range has start and end indexes.

public class IntRange : IEquatable<IntRange>
Inheritance
IntRange
Implements
Inherited Members

Remarks

Range is used by the C# compiler to support the range syntax.

int[] someArray = new int[5] { 1, 2, 3, 4, 5 };
int[] subArray1 = someArray[0..2]; // { 1, 2 }
int[] subArray2 = someArray[1..^0]; // { 2, 3, 4, 5 }

Constructors

IntRange(Index, Index)

Construct a Range object using the start and end indexes.

public IntRange(Index start, Index end)

Parameters

start Index

Represent the inclusive start index of the range.

end Index

Represent the exclusive end index of the range.

Properties

All

Create a Range object starting from first element to the end.

public static IntRange All { get; }

Property Value

IntRange

End

Represent the exclusive end index of the Range.

public Index End { get; }

Property Value

Index

Start

Represent the inclusive start index of the Range.

public Index Start { get; }

Property Value

Index

Methods

EndAt(Index)

Create a Range object starting from first element in the collection to the end Index.

public static IntRange EndAt(Index end)

Parameters

end Index

Returns

IntRange

Equals(IntRange)

Indicates whether the current Range object is equal to another Range object.

public bool Equals(IntRange other)

Parameters

other IntRange

An object to compare with this object

Returns

bool

Equals(object?)

Indicates whether the current Range object is equal to another object of the same type.

public override bool Equals(object? value)

Parameters

value object

An object to compare with this object

Returns

bool

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

GetOffsetAndLength(int)

Calculate the start offset and length of range object using a collection length.

public (int Offset, int Length) GetOffsetAndLength(int length)

Parameters

length int

The length of the collection that the range will be used with. length has to be a positive value.

Returns

(int Offset, int Length)

Remarks

For performance reason, we don't validate the input length parameter against negative values. It is expected Range will be used with collections which always have non negative length/count. We validate the range is inside the length scope though.

StartAt(Index)

Create a Range object starting from start index to the end of the collection.

public static IntRange StartAt(Index start)

Parameters

start Index

Returns

IntRange

ToString()

Converts the value of the current Range object to its equivalent string representation.

public override string ToString()

Returns

string