diff --git a/Sanchime.Functional/Extensions/IEnumerable.cs b/Sanchime.Functional/Extensions/IEnumerable.cs index ef5e4b7..f60e8a8 100644 --- a/Sanchime.Functional/Extensions/IEnumerable.cs +++ b/Sanchime.Functional/Extensions/IEnumerable.cs @@ -93,11 +93,20 @@ public static class IEnumerableExtension public static IEnumerable ForEach(this IEnumerable source, Action action) => source.Map(action.ToFunc()).ToImmutableList(); - public static IEnumerable Bind(this IEnumerable source, Func> func) - => source.SelectMany(func); + public static IEnumerable Bind(this IEnumerable source, Func> binding) + => source.SelectMany(binding); - public static IEnumerable Bind(this IEnumerable source, Func> func) - => source.Bind(t => func(t).AsEnumerable()); + public static IEnumerable Bind(this IEnumerable source, Func> binding) + => source.Bind(val => binding(val).AsEnumerable()); + + /// + /// 将二级序列平展 + /// + /// + /// + /// + public static IEnumerable Flatten(this IEnumerable> source) + => source.SelectMany(x => x); private static IEnumerable List(T t)