NRange Struct

Definition

Represents a range that has start and end indices.

public value class NRange : IEquatable<System::Buffers::NRange>
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5001", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public readonly struct NRange : IEquatable<System.Buffers.NRange>
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5001", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type NRange = struct
Public Structure NRange
Implements IEquatable(Of NRange)
Inheritance
NRange
Attributes
Implements

Remarks

``` 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

NRange(NIndex, NIndex)

Constructs an NRange object using the start and end NIndex.

NRange(Range)

Constructs an NRange object using a Range.

Properties

All

Creates an NRange object starting from first element to the end.

End

Gets the exclusive end NIndex of the NRange.

Start

Gets the inclusive start NIndex of the NRange.

Methods

EndAt(NIndex)

Creates an NRange object starting from first element in the collection to the end NIndex.

Equals(NRange)

Compares the current NRange object to another NRange object for equality.

Equals(Object)

Compares the current NRange object to another object of the same type for equality.

GetHashCode()

Returns the hash code for this instance.

GetOffsetAndLength(IntPtr)

Calculates the start offset and length of the NRange object using a collection length.

StartAt(NIndex)

Creates an NRange object starting from start NIndex to the end of the collection.

ToRange()

Converts a NRange to a Range.

ToRangeUnchecked()

Converts a NRange to a Range without doing bounds checks.

ToString()

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

Operators

CheckedExplicit(NRange to Range)
Explicit(NRange to Range)

Explicitly converts an NRange to a Range without doing bounds checks.

Implicit(Range to NRange)

Implicitly converts a Range to an NRange.

Applies to