1
This commit is contained in:
@@ -147,6 +147,21 @@ namespace BITKit
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<T> SelectManyPro<T>(this IEnumerable<T> self, Func<T, IEnumerable<T>> factory)
|
||||
{
|
||||
return Get(self);
|
||||
IEnumerable<T> Get(IEnumerable<T> list)
|
||||
{
|
||||
var newList = new List<T>();
|
||||
foreach (var x in list)
|
||||
{
|
||||
newList.Add(x);
|
||||
newList.AddRange(Get(factory.Invoke(x)));
|
||||
}
|
||||
|
||||
return newList.Distinct();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取集合中所有的组合,每个组合中的元素个数为输入集合的元素个数,每个元素只出现一次
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user