Skip to content

Instantly share code, notes, and snippets.

@n0mimono
Created June 9, 2015 12:00
Show Gist options
  • Save n0mimono/813e8c592b7209d9c58c to your computer and use it in GitHub Desktop.
Save n0mimono/813e8c592b7209d9c58c to your computer and use it in GitHub Desktop.
My LINQ for C#
public static class MyLinq {
public static IEnumerable<TResult> MySelect<T,TResult>(this IEnumerable<T> e, System.Func<T, TResult> selector) {
foreach (T val in e) {
TResult res = selector (val);
yield return res;
}
}
public static List<T> MyToList<T>(this IEnumerable<T> e) {
List<T> list = new List<T> ();
foreach (T item in e) {
list.Add (item);
}
return list;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment