Class Segment<T>
Represents the segment of an
Представляет сегмент
Implements
Namespace: Platform.Collections.Segments
Assembly: Platform.Collections.dll
Syntax
public class Segment<T> : IEquatable<Segment<T>>, IList<T>
Type Parameters
Name | Description |
---|---|
T | The segment elements type. Тип элементов сегмента. |
Constructors
| Improve this Doc View SourceSegment(IList<T>, Int32, Int32)
Initializes a new instance of the base
list, offset
of the segment and its length
.
Инициализирует новый экземпляр класса base
, offset
сегмента и его length
.
Declaration
public Segment(IList<T> base, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | base | The reference to the original list containing the elements of this segment. Ссылка на исходный список в котором находятся элементы этого сегмента. |
Int32 | offset | The offset relative to the Смещение относительно списка |
Int32 | length | The segment's length. Длина сегмента. |
Properties
| Improve this Doc View SourceBase
Gets the original list (this segment is a part of it).
Возвращает исходный список (частью которого является этот сегмент).
Declaration
public IList<T> Base { get; }
Property Value
Type | Description |
---|---|
IList<T> |
Count
Gets the number of elements contained in the
Возвращает число элементов, содержащихся в
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of elements contained in the Число элементов, содержащихся в |
IsReadOnly
Gets a value indicating whether the
Возвращает значение, указывающее, является ли
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
Boolean | true if the Значение true, если |
Remarks
Any
Любой
Item[Int32]
The value.
Declaration
public T this[int i] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | i |
Property Value
Type | Description |
---|---|
T |
Length
Gets the length of a segment.
Возвращает длину сегмента.
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
Int32 |
Offset
Gets the offset relative to the source list (the index at which this segment starts).
Возвращает смещение относительного исходного списка (индекс с которого начинается этот сегмент).
Declaration
public int Offset { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceAdd(T)
Adds an item to the
Добавляет элемент в
Declaration
public void Add(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The element to add to the Элемент, добавляемый в |
Clear()
Removes all items from the
Удаляет все элементы из
Declaration
public void Clear()
Contains(T)
Determines whether the
Определяет, содержит ли
Declaration
public bool Contains(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The value to locate in the Значение, которое нужно найти в |
Returns
Type | Description |
---|---|
Boolean | true if the value is found in the Значение true, если значение находится в |
CopyTo(T[], Int32)
Copies the elements of the
Копирует элементы
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | A one-dimensional array that is the destination of the elements copied from Одномерный массив, который является местом назначения элементов, скопированных из |
Int32 | arrayIndex | The zero-based index in Отсчитываемый от нуля индекс в массиве |
Equals(Segment<T>)
Declaration
public virtual bool Equals(Segment<T> other)
Parameters
Type | Name | Description |
---|---|---|
Segment<T> | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Determines whether this instance equals.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The obj.
|
Returns
Type | Description |
---|---|
Boolean | The bool
|
GetEnumerator()
Gets an enumerator that iterates through a
Возвращает перечислитель, который осуществляет итерацию по
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<T> | An IEnumerator object that can be used to iterate through the the Объект IEnumerator, который можно использовать для перебора |
GetHashCode()
Gets the hash code of the current
Возвращает хэш-код текущего экземпляра
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
IndexOf(T)
Determines the index of a specific item in the
Определяет индекс конкретного элемента в
Declaration
public int IndexOf(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to locate in the Элемент для поиска в |
Returns
Type | Description |
---|---|
Int32 | The index of Индекс |
Insert(Int32, T)
Inserts an item to the
Вставляет элемент в
Declaration
public void Insert(int index, T item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index at which Отсчитываемый от нуля индекс, по которому следует вставить элемент |
T | item | The element to insert into the Элемент, вставляемый в |
Remove(T)
Removes the first occurrence of a specific value from the
Удаляет первое вхождение указанного значения из
Declaration
public bool Remove(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The value to remove from the Значение, которые нужно удалить из |
Returns
Type | Description |
---|---|
Boolean |
RemoveAt(Int32)
Removes the
Удаляет элемент
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the item to remove. Отсчитываемый от нуля индекс элемента для удаления. |