Objects If you can provide references to related objects, it is a collection called enumeration and traversal. The collection must perform the interface system.collentions.Lenumerable, leNumerable only defines a method, as shown below:
Interface IEnumeralbe
{
IEnumerator getenumerator ();
}
The IEnumerator works as follows: Execute the object of the interface is associated with a collection, this object is in the first initialization, there is no element in the collection, you must call MoveNext (), move the enumeration, to make it point to the collection The first element in it. The element is then obtained with the Current property, and the current property returns an object reference, so it must convert its data type to the object type found in the collection. The object can be passed again after any operation, and then call the MoveNext () method to move to the next element of the collection, repeat this process until there is no element in the collection, and when the current property returns null, it means that the end of the collection . If you want to return the beginning of the collection at any time, you can call the reset () method. Note that the reset () method returns the position in front of the collections
An array is also a collection because the foreach command can act on an array. For the enumeration array provided by the System.Array class, you can traverse the elements of the elements from 0 from 0.