mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-01 15:49:11 +00:00
22 lines
661 B
C#
22 lines
661 B
C#
using System.Collections.Generic;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DiscordChatExporter.Core.Services
|
|
{
|
|
public static class Extensions
|
|
{
|
|
private static async ValueTask<IReadOnlyList<T>> AggregateAsync<T>(this IAsyncEnumerable<T> asyncEnumerable)
|
|
{
|
|
var list = new List<T>();
|
|
|
|
await foreach (var i in asyncEnumerable)
|
|
list.Add(i);
|
|
|
|
return list;
|
|
}
|
|
|
|
public static ValueTaskAwaiter<IReadOnlyList<T>> GetAwaiter<T>(this IAsyncEnumerable<T> asyncEnumerable) =>
|
|
asyncEnumerable.AggregateAsync().GetAwaiter();
|
|
}
|
|
} |