Class ListIndexBasedIEnumerator<T>
- Namespace
- Hi.Common.Collections
- Assembly
- HiGeom.dll
Provides an enumerator that iterates over a specified range of indices in a list.
public class ListIndexBasedIEnumerator<T> : IEnumerator<T>, IEnumerator, IDisposable
Type Parameters
T
The type of elements in the list.
- Inheritance
-
ListIndexBasedIEnumerator<T>
- Implements
-
IEnumerator<T>
- Inherited Members
- Extension Methods
Constructors
ListIndexBasedIEnumerator(IList<T>, int, int, int)
Initializes a new instance of the ListIndexBasedIEnumerator<T> class.
public ListIndexBasedIEnumerator(IList<T> source, int index, int begin, int end)
Parameters
source
IList<T>The source list to enumerate.
index
intThe current index.
begin
intThe starting index (inclusive).
end
intThe ending index (exclusive).
Properties
Begin
Gets or sets the beginning index of the enumeration range.
public int Begin { get; set; }
Property Value
Current
Gets the element in the collection at the current position of the enumerator.
public T Current { get; }
Property Value
- T
The element in the collection at the current position of the enumerator.
End
Gets or sets the ending index of the enumeration range.
public int End { get; set; }
Property Value
Index
Gets or sets the current index in the enumeration.
public int Index { get; set; }
Property Value
Source
Gets or sets the source list being enumerated.
public IList<T> Source { get; set; }
Property Value
- IList<T>
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
MoveNext()
Advances the enumerator to the next element of the collection.
public bool MoveNext()
Returns
- bool
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
Exceptions
- InvalidOperationException
The collection was modified after the enumerator was created.
Reset()
Sets the enumerator to its initial position, which is before the first element in the collection.
public void Reset()
Exceptions
- InvalidOperationException
The collection was modified after the enumerator was created.
- NotSupportedException
The enumerator does not support being reset.