Moved AsyncEnumerable extension
This commit is contained in:
14
src/Discord.Net.Core/Extensions/AsyncEnumerableExtensions.cs
Normal file
14
src/Discord.Net.Core/Extensions/AsyncEnumerableExtensions.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Discord
|
||||||
|
{
|
||||||
|
public static class AsyncEnumerableExtensions
|
||||||
|
{
|
||||||
|
public static async Task<IEnumerable<T>> Flatten<T>(this IAsyncEnumerable<IReadOnlyCollection<T>> source)
|
||||||
|
{
|
||||||
|
return (await source.ToArray().ConfigureAwait(false)).SelectMany(x => x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,12 +56,4 @@ namespace Discord
|
|||||||
public void Dispose() { Current = null; }
|
public void Dispose() { Current = null; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PagedAsyncEnumerable
|
|
||||||
{
|
|
||||||
public static async Task<IEnumerable<T>> Flatten<T>(this IAsyncEnumerable<IReadOnlyCollection<T>> source)
|
|
||||||
{
|
|
||||||
return (await source.ToArray().ConfigureAwait(false)).SelectMany(x => x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user