<PackageReference Include="Microsoft.Bcl.Memory" Version="11.0.0" />

System.Index

public struct Index : IEquatable<Index>
Represent a type can be used to index a collection either from the start or the end.
namespace System { public readonly struct Index : IEquatable<Index> { public static Index Start { get; } public static Index End { get; } public int Value { get; } public bool IsFromEnd { get; } public Index(int value, bool fromEnd = false); public static Index FromStart(int value); public static Index FromEnd(int value); public int GetOffset(int length); public bool Equals(Index other); public static implicit operator Index(int value); } }