Изменить

Поделиться через


NIndex Struct

Definition

Represents a type that can be used to index a collection either from the start or the end.

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

Examples

int[] someArray = new int[5] { 1, 2, 3, 4, 5 } ;
int lastElement = someArray[^1]; // lastElement = 5

Remarks

``` int[] someArray = new int[5] { 1, 2, 3, 4, 5 } ; int lastElement = someArray[^1]; // lastElement = 5 ```

Constructors

NIndex(Index)

Constructs an NIndex from an Index.

NIndex(IntPtr, Boolean)

Constructs an NIndex using an index value and a Boolean that indicates if the NIndex is from the start or from the end.

Properties

End

Creates an NIndex that points beyond the last element.

IsFromEnd

Gets a value that indicates whether the NIndex is from the start or the end.

Start

Creates an NIndex that points at the first element.

Value

Gets the NIndex value.

Methods

Equals(NIndex)

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

Equals(Object)

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

FromEnd(IntPtr)

Creates an NIndex from the end at the specified position.

FromStart(IntPtr)

Creates an NIndex from the start at the specified position.

GetHashCode()

Returns the hash code for this instance.

GetOffset(IntPtr)

Calculates the offset from the start using the given collection length.

ToIndex()

Converts the NIndex to an Index.

ToIndexUnchecked()

Converts the NIndex to an Index without doing bounds checks.

ToString()

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

Operators

CheckedExplicit(NIndex to Index)
Explicit(NIndex to Index)

Converts an NIndex to an Index.

Implicit(Index to NIndex)

Converts a native integer number to an NIndex.

Implicit(IntPtr to NIndex)

Converts an integer number to an NIndex.

Applies to