NIndex Struct
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- Attributes
- Implements
int[] someArray = new int[5] { 1, 2, 3, 4, 5 } ;
int lastElement = someArray[^1]; // lastElement = 5
``` int[] someArray = new int[5] { 1, 2, 3, 4, 5 } ; int lastElement = someArray[^1]; // lastElement = 5 ```
NIndex(Index) | |
NIndex(Int |
Constructs an NIndex using an index value and a Boolean that indicates if the NIndex is from the start or from the end. |
End |
Creates an NIndex that points beyond the last element. |
Is |
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. |
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. |
From |
Creates an NIndex from the end at the specified position. |
From |
Creates an NIndex from the start at the specified position. |
Get |
Returns the hash code for this instance. |
Get |
Calculates the offset from the start using the given collection length. |
To |
|
To |
Converts the NIndex to an Index without doing bounds checks. |
To |
Converts the value of the current NIndex object to its equivalent string representation. |
Checked |
|
Explicit(NIndex to Index) | |
Implicit(Index to NIndex) |
Converts a native integer number to an NIndex. |
Implicit(Int |
Converts an integer number to an NIndex. |
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: