pmMDA.NET

PagedSet.PagedSetEnumerable.GetEnumerator Method 

[This is preliminary documentation and subject to change.]

Returns an enumerator for a subset of the set.

public IEnumerator GetEnumerator();

Return Value

An IEnumerator for a subset of the set.

Implements

IEnumerable.GetEnumerator

Remarks

Enumerators only allow reading the data in the collection. Enumerators cannot be used to modify the underlying collection.

Initially, the enumerator is positioned before the first item in the collection. Reset also brings the enumerator back to this position. At this position, calling Current throws an exception. Therefore, you must call MoveNext to advance the enumerator to the first item of the collection before reading the value of Current.

The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads could still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.

See Also

PagedSet.PagedSetEnumerable Class | PmMda.Net.Dog.Paging Namespace