(According to the msdn webcast courses)
Solve the collection and access problems.
The internal structures of the set mainly include linked list and sequential.
Component developers often want to provide flexible external access without exposing the internal structure of the component.
Gof: provides a method to access each element of an aggregate object sequentially without exposing the organization structure of the object.
Myenumerator inherits from ienumerator, so it is the same field and method. In mycollection, get the myenumerator object through the getenumable () method, so as to achieve sequential access to objects in mycollection.
In the C # environment, we can also use the iterator more conveniently:
In addition, after C #2.0, we can also conveniently implement the getenumerator () method:
In the iterator, we cannot change the values of individual elements in the collection object or the container structure. We should make sure that each element in the set is traversed only once.
<End>