Szerkesztés

Megosztás a következőn keresztül:


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>
[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)

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

Gets a value that 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()

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