Created
June 9, 2015 12:00
-
-
Save n0mimono/813e8c592b7209d9c58c to your computer and use it in GitHub Desktop.
My LINQ for C#
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 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