Add SelectMany for IAsyncEnumerable + IEnumerable

This commit is contained in:
ig 2023-09-14 14:22:26 +02:00
parent 3ce40b936a
commit 8d4eadc540
2 changed files with 7 additions and 4 deletions

View File

@ -5,6 +5,12 @@ namespace InnovEnergy.Lib.Utils;
public static class AsyncEnumerableEx
{
public static IAsyncEnumerable<R> SelectMany<T, R>(this IAsyncEnumerable<T> ts, Func<T, IEnumerable<R>> map)
{
return ts.SelectMany<T, R>(t => map(t).ToAsyncEnumerable());
}
public static async IAsyncEnumerable<T> Throttle<T>(this IAsyncEnumerable<T> ts,
TimeSpan dueTime,
[EnumeratorCancellation] CancellationToken cancel = default)

View File

@ -1,8 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configurations>Debug;Release;Release-Server</Configurations>
<Platforms>AnyCPU;linux-arm</Platforms>
</PropertyGroup>
<Import Project="../InnovEnergy.Lib.props" />
<PropertyGroup>
@ -12,6 +8,7 @@
<ItemGroup>
<PackageReference Include="CliWrap" Version="3.6.0" />
<PackageReference Include="DecimalMath.DecimalEx" Version="1.0.2" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="System.Reactive.Linq" Version="5.0.0" />
</ItemGroup>