ToEnumerable()

public static IEnumerable<T> ToEnumerable<T>(this IEnumerator<T> enumerator)
{
	while (enumerator.MoveNext())
		yield return enumerator.Current;

	yield break;
}
Example:
IEnumerator<string> enumerator = ...;

foreach (var str in enumerator.ToEnumerable())
	Console.WriteLine(str);

Description

Convert an IEnumerator<T> to IEnumerable<T>.

Details

Double click on the code to select all.

 

;