using System.Collections.Generic;
public static void Main(string[] args)
string[] listOfNames = new string[] { "John", "Axel", "Alex", "Peter", "Adam", "Jesus", "Michael", "Jeffrey", "Alex", "Peter", "John", "Adam" };
int[] listOfInts = new int[] { 5, 10, 50, 23, 33, -5, 5, 12, 33 };
listOfNames.MapReduce(s => s.Length > 10);
public static class CustomMapReduce
public static IEnumerable<TResult> CustomSelect<T, TResult>(IEnumerable<T> source, Func<T, TResult> predicate)
foreach (var item in source)
yield return predicate(item);
public static IGrouping<T, TKey> CustomGroupBy(IEnumerable<T> source, Func<T, IEnumerable<T>> predicate)
public static T CustomReduce<T>(IEnumerable<T> source, Func<T,T,T> predicate)
IEnumerator<T> enumerator = source.GetEnumerator();
T result = enumerator.Current;
while(enumerator.MoveNext())
result = predicate(result, enumerator.Current);