exercism/csharp/accumulate/Accumulate.cs

11 lines
271 B
C#
Raw Normal View History

2018-03-02 22:27:55 +00:00
using System;
using System.Collections.Generic;
public static class AccumulateExtensions
{
public static IEnumerable<U> Accumulate<T, U>(this IEnumerable<T> collection, Func<T, U> func)
{
foreach (var elem in collection) yield return func(elem);
}
}