Exemplo n.º 1
0
    // Serially, and synchronously loop through the internal data and execute the function given by the delegate
    // parameter. Notice that the Reduce function does not modify any of the internal data.
    public T Reduce(ModReduce mr)
    {
        T ret = data[0];

        for (int i = 1; i < Count; i++)
        {
            ret = mr(ret, data[i]);
        }

        return(ret);
    }
Exemplo n.º 2
0
 public async Task <T> ReduceAsync(ModReduce mr)
 {
     return(await Task.Run(() => {
         return Reduce(mr);
     }));
 }