Struct ListSegment<T>
Delimits a section of a list.
Inherited Members
Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public struct ListSegment<T> : IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
Name | Description |
---|---|
T | The type of elements in the section. |
Remarks
This collection is read-only and does not allow the addition or removal of elements. However individual elements of the list can be modified using indexer.
Constructors
| Improve this Doc View SourceListSegment(IList<T>, Range)
Initializes a new segment of the list.
Declaration
public ListSegment(IList<T> list, Range range)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | The list containing the range of elements to delimit. |
Range | range | The range of elements. |
Properties
| Improve this Doc View SourceCount
Gets the number of elements in the segment.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Item[Int32]
Gets or sets element at the specified index.
Declaration
public T this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the element in this segment. |
Property Value
Type | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
Methods
| Improve this Doc View SourceContains(T)
Determines whether this section contains a specified value.
Declaration
public bool Contains(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to locate in this section. |
Returns
Type | Description |
---|---|
Boolean | true if item is found in this section; otherwise, false. |
CopyTo(T[], Int32)
Copies the elements in this section to an array.
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The destination of the elements copied from this section. |
Int32 | arrayIndex | The zero-based index in |
GetEnumerator()
Gets enumerator of elements in this section.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<T> | The enumerator of elements in this section. |
IndexOf(T)
Determines the index of a specific item.
Declaration
public int IndexOf(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to locate in this section. |
Returns
Type | Description |
---|---|
Int32 | The index of |
Explicit Interface Implementations
| Improve this Doc View SourceICollection<T>.Add(T)
Declaration
void ICollection<T>.Add(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item |
ICollection<T>.Clear()
Declaration
void ICollection<T>.Clear()
ICollection<T>.IsReadOnly
Declaration
bool ICollection<T>.IsReadOnly { get; }
Returns
Type | Description |
---|---|
Boolean |
ICollection<T>.Remove(T)
Declaration
bool ICollection<T>.Remove(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item |
Returns
Type | Description |
---|---|
Boolean |
IList<T>.Insert(Int32, T)
Declaration
void IList<T>.Insert(int index, T item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | |
T | item |
IList<T>.RemoveAt(Int32)
Declaration
void IList<T>.RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator |