METHOD
ChannelReader<T>.WaitToReadAsync
Waits for possible availability; another consumer may take the item first, so TryRead must still be checked. False indicates normal completion without remaining data; errors and cancellation can propagate.
Formal Syntax & Structure
csharp syntaxcsharp
await reader.WaitToReadAsync(token)Working Example
Example Snippetcsharp
using System;using System.Collections.Generic;using System.Threading;using System.Threading.Tasks;using System.Threading.Channels;var c=Channel.CreateBounded<int>(1); c.Writer.TryComplete(); Console.WriteLine(await c.Reader.WaitToReadAsync()); // False