* cleanup scanner project * cleanup infrastructure projects * cleanup ffmpeg project * cleanup core project * cleanup app project * cleanup main project * update dependencies * code cleanup
27 lines
890 B
C#
27 lines
890 B
C#
namespace ErsatzTV.Infrastructure;
|
|
|
|
public static class AsyncEnumerable
|
|
{
|
|
/// <summary>
|
|
/// Creates an <see cref="IAsyncEnumerable{T}" /> which yields no results, similar to
|
|
/// <see cref="Enumerable.Empty{TResult}" />.
|
|
/// </summary>
|
|
public static IAsyncEnumerable<T> Empty<T>() => EmptyAsyncEnumerator<T>.Instance;
|
|
|
|
private sealed class EmptyAsyncEnumerator<T> : IAsyncEnumerator<T>, IAsyncEnumerable<T>
|
|
{
|
|
public static readonly EmptyAsyncEnumerator<T> Instance = new();
|
|
|
|
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)
|
|
{
|
|
cancellationToken.ThrowIfCancellationRequested();
|
|
return this;
|
|
}
|
|
|
|
public T Current => default;
|
|
public ValueTask DisposeAsync() => default;
|
|
|
|
public ValueTask<bool> MoveNextAsync() => new(false);
|
|
}
|
|
}
|