namespace NSExt.Extensions;
///
/// EnumerableExtensions
///
public static class EnumerableExtensions
{
///
/// 异步累加器函数
///
/// InvalidOperationException
public static async Task AggregateAsync( //
this IEnumerable source, Func> func)
{
using var e = source.GetEnumerator();
if (!e.MoveNext()) {
throw new InvalidOperationException("Sequence contains no elements");
}
var result = e.Current;
while (e.MoveNext()) {
result = await func(result, e.Current).ConfigureAwait(false);
}
return result;
}
///
/// 将列表转成分隔符分隔的字符串
///
public static string Join(this IEnumerable