Skip to content

Instantly share code, notes, and snippets.

@jehugaleahsa
Created August 14, 2014 19:22
Show Gist options
  • Save jehugaleahsa/e2441ebcc3cda016b3a2 to your computer and use it in GitHub Desktop.
Save jehugaleahsa/e2441ebcc3cda016b3a2 to your computer and use it in GitHub Desktop.
foreach (int i in items)
{
Console.Out.WriteLine(i);
}
IEnumerator enumerator = ((IEnumerable)items).GetEnumerator();
try
{
int i;
while (enumerator.MoveNext())
{
i = (int)enumerator.Current;
Console.Out.WriteLine(i);
}
}
finally
{
IDisposable disposable = item as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment