편집

다음을 통해 공유


NIndex Struct

Definition

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

public value class NIndex : IEquatable<System::Buffers::NIndex>
public readonly struct NIndex : IEquatable<System.Buffers.NIndex>
type NIndex = struct
Public Structure NIndex
Implements IEquatable(Of NIndex)
Inheritance
NIndex
Implements

Examples

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

Constructors

NIndex(Index)

Construct a NIndex from a Index

NIndex(IntPtr, Boolean)

Construct an NIndex using a value and indicating if the NIndex is from the start or from the end.

Properties

End

Create an NIndex pointing at beyond last element.

IsFromEnd

Indicates whether the NIndex is from the start or the end.

Start

Create an NIndex pointing at first element.

Value

Returns the NIndex value.

Methods

Equals(NIndex)

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

Equals(Object)

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

FromEnd(IntPtr)

Create an NIndex from the end at the position indicated by the value.

FromStart(IntPtr)

Create an NIndex from the start at the position indicated by the value.

GetHashCode()

Returns the hash code for this instance.

GetOffset(IntPtr)

Calculate the offset from the start using the giving collection length.

ToIndex()
ToIndexUnchecked()
ToString()

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

Operators

CheckedExplicit(NIndex)
Explicit(NIndex to Index)

Converts a NIndex to an Index."/>

Implicit(Index to NIndex)

Converts native integer number to an NIndex.

Implicit(IntPtr to NIndex)

Converts integer number to an NIndex.

Applies to