Created
March 16, 2015 15:49
-
-
Save Salada/6e00ef41e2d9810cb5e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class AotSafeExtensions | |
{ | |
// こんなメソッドを用意しておくと | |
public static IEnumerable<T> AsSafeEnumerable<T>(this IEnumerable<T> source) | |
{ | |
var e = ((IEnumerable)source).GetEnumerator(); | |
using (e as IDisposable) | |
{ | |
while (e.MoveNext()) | |
{ | |
yield return (T)e.Current; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source : http://neue.cc/2014/07/01_474.html