From 87360d75ab8c2a5d8e30702b9213bda362af3cd4 Mon Sep 17 00:00:00 2001 From: qwsdcvghyu89 <61093706+qwsdcvghyu89@users.noreply.github.com> Date: Thu, 26 Jun 2025 14:52:00 +0300 Subject: [PATCH] refactor: update DownloadEnumerable to use IAsyncEnumerable The DownloadEnumerable class has been refactored to accept an IAsyncEnumerable> instead of an IAsyncEnumerator>. This change simplifies the class and improves its usability. This allows for better integration with asynchronous streaming of data, enhancing performance and flexibility. --- Beam/DownloadEnumerable.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Beam/DownloadEnumerable.cs b/Beam/DownloadEnumerable.cs index 2855e84..29ed543 100644 --- a/Beam/DownloadEnumerable.cs +++ b/Beam/DownloadEnumerable.cs @@ -5,13 +5,19 @@ using System.Text; using System.Threading.Tasks; namespace Beam { - public class DownloadEnumerable(IAsyncEnumerator> download) : IAsyncEnumerable> { - public IAsyncEnumerator> Download { get; } = download; + //public class DownloadEnumerable(IAsyncEnumerator> download) : IAsyncEnumerable> { + // public IAsyncEnumerator> Download { get; } = download; - public IAsyncEnumerator> GetAsyncEnumerator(CancellationToken cancellationToken = default) - => Download; + // public IAsyncEnumerator> GetAsyncEnumerator(CancellationToken cancellationToken = default) + // => Download; - public static DownloadEnumerable Empty() - => new(Array.Empty>().ToAsyncEnumerable().GetAsyncEnumerator()); + // public static DownloadEnumerable Empty() + // => new(Array.Empty>().ToAsyncEnumerable().GetAsyncEnumerator()); + //} + + public class DownloadEnumerable(IAsyncEnumerable> download) : IAsyncEnumerable> { + public IAsyncEnumerator> GetAsyncEnumerator(CancellationToken cancellationToken = default) { + return download.GetAsyncEnumerator(cancellationToken); + } } }