Range Estructura
Definición
Representa un rango que tiene índices de inicio y fin.Represents a range that has start and end indexes.
public value class Range : IEquatable<Range>
public struct Range : IEquatable<Range>
type Range = struct
Public Structure Range
Implements IEquatable(Of Range)
- Herencia
- Implementaciones
Comentarios
Range lo usa el compilador de C# para admitir la sintaxis de intervalo:Range is used by the C# compiler to support the range syntax:
int[] someArray = new int[5] { 1, 2, 3, 4, 5 };
int[] subArray1 = someArray[0..2]; // { 1, 2 }
int[] subArray2 = someArray[1..^0]; // { 2, 3, 4, 5 }
Constructores
| Range(Index, Index) |
Crea una nueva instancia de Range con los índices de inicio y finalización especificados.Instantiates a new Range instance with the specified starting and ending indexes. |
Propiedades
| All |
Obtiene un objeto Range que comienza desde el primer elemento hasta el final.Gets a Range object that starts from the first element to the end. |
| End |
Obtiene un elemento Index que representa el índice de finalización exclusivo del rango.Gets an Index that represents the exclusive end index of the range. |
| Start |
Obtiene el índice de inicio inclusivo del Range.Gets the inclusive start index of the Range. |
Métodos
| EndAt(Index) |
Crea un objeto Range desde el primer elemento de la colección hasta el índice de finalización especificado.Creates a Range object starting from the first element in the collection to a specified end index. |
| Equals(Object) |
Devuelve un valor que indica si la instancia de actual es igual que un objeto especificado.Returns a value that indicates whether the current instance is equal to a specified object. |
| Equals(Range) |
Devuelve un valor que indica si la instancia actual es igual que otro objeto Range.Returns a value that indicates whether the current instance is equal to another Range object. |
| GetHashCode() |
Devuelve el código hash de esta instancia.Returns the hash code for this instance. |
| GetOffsetAndLength(Int32) |
Calcula el desplazamiento inicial y la longitud del objeto Range usando una longitud de colección.Calculates the start offset and length of the range object using a collection length. |
| StartAt(Index) |
Devuelve una nueva instancia de Range a partir del índice inicial especificado hasta el final de la colección.Returns a new Range instance starting from a specified start index to the end of the collection. |
| ToString() |
Devuelve la representación de cadena del objeto Range actual.Returns the string representation of the current Range object. |