One possible implementation of SelectMany

public static class Enumerable
{
    public static IEnumerable SelectMany(
        this IEnumerable src,
        Func> inputSelector,
        Func resultSelector)
    {
        foreach (T1 first in src)
        {
            foreach (T2 second in inputSelector(first))
                yield return resultSelector(first, second);
        }
    }
}

你可能感兴趣的:(One possible implementation of SelectMany)