If you do not know how MapReduce works, please refer to here. If you do not know what MapReduce is, please google!
Today, there is nothing to do with "idle". I suddenly remember that there is no MapReduce method in C #. I think about it, coding:
IEnumerable<T>.MapReduce Dictionary<TKey, TResult> MapReduce<TInput, TKey, TValue, TResult> IEnumerable<TInput><TInput, IEnumerable<KeyValuePair<TKey, TValue>>><TKey, IEnumerable<TValue>, TResult><TKey, List<TValue>> mapResult = Dictionary<TKey, List<TValue>> ( item ( one <TValue> (!mapResult.TryGetValue(one.Key, = List<TValue> result = Dictionary<TKey, TResult> ( m
Note: Because emit can be performed multiple times in the map method, IEnumerable is returned here. yield return is used in the following example.
Example:
ID { ; Name { ; Age { ;
Main(<Person> list= List<Person> Person { ID=, Name=, Age= Person { ID = , Name = , Age = Person { ID = , Name = , Age = Person { ID = , Name = , Age = Person { ID = , Name = , Age = result = list.MapReduce<Person, , , >=> .Join( ( d + + IEnumerable<KeyValuePair<, >> (p.Age > KeyValuePair<, >
What the above program did is to count the people of all ages who are older than 22, as shown in:
23: user1, user3
24: user2
25: user4
Press any key to continue...
(It is too troublesome to upload images. I have made an html console. Thank you !)
Some may ask why map does not use lambda expressions like reduce, because yield return cannot be in anonymous and lambda expressions! MS indicates that you already know the problem, but it takes a lot of money to rewrite yield. It will definitely be solved in the future!