Index Estructura
Definición
Representa un tipo que se puede usar para indexar una colección desde el principio o el final.Represents a type that can be used to index a collection either from the start or the end.
public value class Index : IEquatable<Index>
public struct Index : IEquatable<Index>
type Index = struct
Public Structure Index
Implements IEquatable(Of Index)
- Herencia
- Implementaciones
Comentarios
Index
lo usa el compilador de C# para admitir la nueva sintaxis de índice:Index
is used by the C# compiler to support the new index syntax:
int[] someArray = new int[5] { 1, 2, 3, 4, 5 };
int lastElement = someArray[^1]; // lastElement = 5
Constructores
Index(Int32, Boolean) |
Inicializa un nuevo elemento Index con una posición de índice especificada y un valor que indica si el índice está desde el principio o el final de una colección.Initializes a new Index with a specified index position and a value that indicates if the index is from the start or the end of a collection. |
Propiedades
End |
Obtiene un elemento Index que apunta más allá del último elemento.Gets an Index that points beyond the last element. |
IsFromEnd |
Obtiene un valor que indica si el índice es desde el inicio o el final.Gets a value that indicates whether the index is from the start or the end. |
Start |
Obtiene un elemento Index que apunta al primer elemento de una colección.Gets an Index that points to the first element of a collection. |
Value |
Obtiene el valor del índice.Gets the index value. |
Métodos
Equals(Index) |
Devuelve un valor que indica si el objeto actual es igual que otro objeto Index.Returns a value that indicates whether the current object is equal to another Index object. |
Equals(Object) |
Indica si el objeto Índice actual es igual a un objeto especificado.Indicates whether the current Index object is equal to a specified object. |
FromEnd(Int32) |
Crea un elemento Index desde el final de una colección en una posición de índice especificada.Creates an Index from the end of a collection at a specified index position. |
FromStart(Int32) |
Crea un elemento Index desde el índice especificado al principio de una colección.Create an Index from the specified index at the start of a collection. |
GetHashCode() |
Devuelve el código hash de esta instancia.Returns the hash code for this instance. |
GetOffset(Int32) |
Calcula el desplazamiento desde el principio de la colección usando la longitud de la colección especificada.Calculates the offset from the start of the collection using the given collection length. |
ToString() |
Devuelve la representación de cadena de la instancia Index actual.Returns the string representation of the current Index instance. |
Operadores
Implicit(Int32 to Index) |
Convierte el número entero en un índice.Converts integer number to an Index. |