Range Struct
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a range that has start and end indexes.
public value class Range : IEquatable<Range>
public readonly struct Range : IEquatable<Range>
type Range = struct
Public Structure Range
Implements IEquatable(Of Range)
- Inheritance
- Implements
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 }
Range(Index, Index) |
Instantiates a new Range instance with the specified starting and ending indexes. |
All |
Gets a Range object that starts from the first element to the end. |
End |
Gets an Index that represents the exclusive end index of the range. |
Start |
Gets the inclusive start index of the Range. |
End |
Creates a Range object starting from the first element in the collection to a specified end index. |
Equals(Object) |
Returns a value that indicates whether the current instance is equal to a specified object. |
Equals(Range) |
Returns a value that indicates whether the current instance is equal to another Range object. |
Get |
Returns the hash code for this instance. |
Get |
Calculates the start offset and length of the range object using a collection length. |
Start |
Returns a new Range instance starting from a specified start index to the end of the collection. |
To |
Returns the string representation of the current Range object. |
Ürün | Sürümler |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Standard | 2.0 (package-provided), 2.1 |
.NET geri bildirimi
.NET, açık kaynak bir projedir. Geri bildirim sağlamak için bir bağlantı seçin: