Skip to content

Instantly share code, notes, and snippets.

@deapsquatter
Created May 24, 2013 16:05
Show Gist options
  • Save deapsquatter/5644550 to your computer and use it in GitHub Desktop.
Save deapsquatter/5644550 to your computer and use it in GitHub Desktop.
Useful in Xamarin.Droid when having to deal with Java.Util.IEnumeration. Now you can use Linq.
public static class Extensions
{
public static IEnumerable<T> GetEnumerable<T>(this Java.Util.IEnumeration enumeration) where T : class
{
while (enumeration.HasMoreElements)
yield return enumeration.NextElement() as T;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment