Skip to content

Commit 249784e

Browse files
Merge pull request #45 from adamhathcock/expose-asyncenum-net20
Expose AsyncEnumerable on NETSTANDARD20 with dependency
2 parents b01fddd + 9f36e07 commit 249784e

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

Open.ChannelExtensions/Extensions.Source.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,7 @@ public static ChannelReader<T> Source<T>(
254254
TextReader source,
255255
CancellationToken cancellationToken)
256256
=> Source(target, source, out _, false, cancellationToken);
257-
258-
#if NETSTANDARD2_0
259-
#else
257+
260258
/// <inheritdoc cref="SourceAsync{TWrite, TRead}(Channel{TWrite, TRead}, IEnumerable{ValueTask{TWrite}}, out ValueTask{long}, bool, CancellationToken)"/>
261259
public static ChannelReader<TRead> Source<TWrite, TRead>(
262260
this Channel<TWrite, TRead> target,
@@ -288,5 +286,4 @@ public static ChannelReader<TRead> Source<TWrite, TRead>(
288286
IAsyncEnumerable<TWrite> source,
289287
CancellationToken cancellationToken)
290288
=> Source(target, source, false, cancellationToken);
291-
#endif
292289
}

Open.ChannelExtensions/Extensions.Write.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,7 @@ public static ValueTask<long> WriteAllLines(
308308
bool complete,
309309
CancellationToken cancellationToken)
310310
=> WriteAllLines(target, source, complete, false, cancellationToken);
311-
312-
#if NETSTANDARD2_0
313-
#else
311+
314312
/// <summary>
315313
/// Asynchronously writes all entries from the source to the channel.
316314
/// </summary>
@@ -383,5 +381,4 @@ public static ValueTask<long> WriteAllAsync<T>(
383381
bool complete,
384382
CancellationToken cancellationToken)
385383
=> WriteAllAsync(target, source, complete, false, cancellationToken);
386-
#endif
387384
}

Open.ChannelExtensions/Extensions._.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,7 @@ public static ChannelReader<T> ToChannel<T>(this IEnumerable<T> source,
336336
=> CreateChannel<T>(capacity, singleReader)
337337
.Source(source, deferredExecution, cancellationToken);
338338

339-
#if NETSTANDARD2_0
340-
#else
339+
341340
/// <summary>
342341
/// Writes all entries from the source to a channel and calls complete when finished.
343342
/// </summary>
@@ -430,7 +429,6 @@ static async IAsyncEnumerable<TOut> AsAsyncEnumerableCore(Channel<TIn, TOut> cha
430429
&& await reader.WaitToReadAsync(cancellationToken).ConfigureAwait(false));
431430
}
432431
}
433-
#endif
434432

435433
/// <summary>
436434
/// Asynchronously executes all entries and writes their results to a channel.

Open.ChannelExtensions/Open.ChannelExtensions.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
<PackageReference Include="System.Collections.Immutable" Version="8.*" />
5555
</ItemGroup>
5656

57+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' ">
58+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
59+
</ItemGroup>
60+
5761
<!-- Disable the nullable warnings when compiling for .NET Standard 2.0 -->
5862
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
5963
<NoWarn>$(NoWarn);nullable</NoWarn>

0 commit comments

Comments
 (0)