Skip to content

Commit

Permalink
Nudge
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-E-angelo committed Mar 16, 2024
1 parent aa1e427 commit a22d3ec
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DragonSpark.Application.Entities.Queries.Compiled.Evaluation;
Expand All @@ -10,5 +9,13 @@ sealed class ToFirstOrDefault<T> : IEvaluate<T, T?>

ToFirstOrDefault() {}

public ValueTask<T?> Get(IAsyncEnumerable<T> parameter) => parameter.FirstOrDefaultAsync();
public async ValueTask<T?> Get(IAsyncEnumerable<T> parameter)
{
await foreach (var item in parameter.ConfigureAwait(false))
{
return item;
}

return default;
}
}

0 comments on commit a22d3ec

Please sign in to comment.