Range Yapı
Tanım
Başlangıç ve bitiş dizinlerine sahip bir aralığı temsil eder.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)
- Devralma
- Uygulamalar
Açıklamalar
Range , Range sözdizimini desteklemek için C# derleyicisi tarafından kullanılır: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 }
Oluşturucular
| Range(Index, Index) |
RangeBelirtilen başlangıç ve bitiş dizinlerine sahip yeni bir örnek oluşturur.Instantiates a new Range instance with the specified starting and ending indexes. |
Özellikler
| All |
Rangeİlk öğeden sonuna kadar başlayan bir nesne alır.Gets a Range object that starts from the first element to the end. |
| End |
IndexAralığın dışlamalı bitiş dizinini temsil eden bir öğesini alır.Gets an Index that represents the exclusive end index of the range. |
| Start |
Öğesinin dahil başlangıç dizinini alır Range .Gets the inclusive start index of the Range. |
Yöntemler
| EndAt(Index) |
RangeKoleksiyondaki ilk öğeden başlayarak belirtilen bitiş dizinine kadar bir nesne oluşturur.Creates a Range object starting from the first element in the collection to a specified end index. |
| Equals(Object) |
Geçerli örneğin belirtilen bir nesneye eşit olup olmadığını gösteren bir değer döndürür.Returns a value that indicates whether the current instance is equal to a specified object. |
| Equals(Range) |
Geçerli örneğin başka bir nesneye eşit olup olmadığını gösteren bir değer döndürür Range .Returns a value that indicates whether the current instance is equal to another Range object. |
| GetHashCode() |
Bu örneğe ilişkin karma kodu döndürür.Returns the hash code for this instance. |
| GetOffsetAndLength(Int32) |
Bir koleksiyon uzunluğu kullanarak Aralık nesnesinin başlangıç sapmasını ve uzunluğunu hesaplar.Calculates the start offset and length of the range object using a collection length. |
| StartAt(Index) |
RangeBelirtilen başlangıç dizininden koleksiyonun sonuna kadar olan yeni bir örnek döndürür.Returns a new Range instance starting from a specified start index to the end of the collection. |
| ToString() |
Geçerli nesnenin dize gösterimini döndürür Range .Returns the string representation of the current Range object. |