Range Structure
Définition
Représente une plage qui comprend des index de début et de 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)
- Héritage
- Implémente
Remarques
Range
est utilisé par le compilateur C# pour prendre en charge la syntaxe de plage :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 }
Constructeurs
Range(Index, Index) |
Instancie une nouvelle instance Range avec les index de début et de fin spécifiés.Instantiates a new Range instance with the specified starting and ending indexes. |
Propriétés
All |
Obtient un objet Range qui commence au premier élément et va jusqu’à la fin.Gets a Range object that starts from the first element to the end. |
End |
Obtient un Index qui représente l’index de fin exclusive de la plage.Gets an Index that represents the exclusive end index of the range. |
Start |
Obtient l’index de début inclusif de Range.Gets the inclusive start index of the Range. |
Méthodes
EndAt(Index) |
Crée un objet Range en partant du premier élément de la collection jusqu’à un index de fin spécifié.Creates a Range object starting from the first element in the collection to a specified end index. |
Equals(Object) |
Retourne une valeur qui indique si l’instance actuelle est égale à un objet spécifié.Returns a value that indicates whether the current instance is equal to a specified object. |
Equals(Range) |
Retourne une valeur qui indique si l’instance actuelle est égale à un autre objet Range.Returns a value that indicates whether the current instance is equal to another Range object. |
GetHashCode() |
Retourne le code de hachage de cette instance.Returns the hash code for this instance. |
GetOffsetAndLength(Int32) |
Calcule le décalage de début et la longueur de l’objet de plage à l’aide d’une longueur de collection.Calculates the start offset and length of the range object using a collection length. |
StartAt(Index) |
Retourne une nouvelle instance Range en partant d’un index de début spécifié jusqu’à la fin de la collection.Returns a new Range instance starting from a specified start index to the end of the collection. |
ToString() |
Retourne la représentation sous forme de chaîne de l’objet Range actuel.Returns the string representation of the current Range object. |