use IEnumerator
Published: 9. October 2011 | Updated: 9. October 2011License: Microsoft Public License (MS-PL)
Categories: Collections
Tags: C# Collections
Import namespace
using System.Collections;
Code
var collection = new[] { 1, 2, 3, 4, 5 }; IEnumerator enumerator = collection.GetEnumerator(); while (enumerator.MoveNext()) { Console.WriteLine(enumerator.Current); }Console Output:
1
2
3
4
5
2
3
4
5
| Send us feedback about this snippet » |





