struct Index

in global :: System

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


public Index( int value, bool fromEnd = False )

Initializes a new with a specified index position and a value that indicates if the index is from the start or the end of a collection.

  • value The index value. It has to be greater or equal than zero.
  • fromEnd A boolean indicating if the index is from the start () or from the end () of a collection.

public static Index End { get; }

Gets an that points beyond the last element.

  • Returns an that points beyond the last element.

public bool Equals( Index other )

Returns a value that indicates whether the current object is equal to another object.

  • other The object to compare with this instance.
  • Returns if the current Index object is equal to ; otherwise.

public bool Equals( object value )

Indicates whether the current Index object is equal to a specified object.

  • value An object to compare with this instance.
  • Returns if is of type and is equal to the current instance; otherwise.

public static Index FromEnd( int value )

Creates an from the end of a collection at a specified index position.

  • value The index value from the end of a collection.
  • Returns The Index value.

public static Index FromStart( int value )

Create an from the specified index at the start of a collection.

  • value The index position from the start of a collection.
  • Returns The index value.

public int GetOffset( int length )

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

  • length The length of the collection that the Index will be used with. Must be a positive value.
  • Returns The offset.

public bool IsFromEnd { get; }

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

  • Returns if the Index is from the end; otherwise, <see. langword="false"></see.>.

public static Index Start { get; }

Gets an that points to the first element of a collection.

  • Returns An instance that points to the first element of a collection.

public int Value { get; }

Gets the index value.

  • Returns The index value.

public int GetHashCode( )

😔 No documentation found.

public static Index op_Implicit( int value )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.