other/Scripts/Network/RPCNet/Base/AsyncCollection.cs
/// <summary>Takes an item from the AsyncCollection asynchronously.</summary>
/// <returns>The item removed from the collection.</returns>
/// <exception cref="T:System.InvalidOperationException">The AsyncCollection is empty and has been marked
/// as complete with regards to additions.</exception>
/// <exception cref="T:System.ObjectDisposedException">The AsyncCollection has been disposed.</exception>
Takes an item from the AsyncCollection asynchronously.
Takes an item from the AsyncCollection asynchronously .
public async Task<T> TakeAsync(CancellationToken cancellationToken = new CancellationToken())
        {
            CheckDisposed();
            CancellationTokenSource linked =
                CancellationTokenSource.CreateLinkedTokenSource(doneCancellationToken.Token, cancellationToken);
            try
            {
                var (success, result) = await TryTakeAsync(cancellationToken, linked.Token).ConfigureAwait(false);
                if (success)
                    return result;
                throw new InvalidOperationException("Can't take when done");
            }
            finally
            {
                linked.Dispose();
            }
        }
public async Task < T > TakeAsync ( CancellationToken cancellationToken = new CancellationToken ( ) ) { CheckDisposed ( ) ; CancellationTokenSource linked = CancellationTokenSource . CreateLinkedTokenSource ( doneCancellationToken . Token , cancellationToken ) ; try { var ( success , result ) = await TryTakeAsync ( cancellationToken , linked . Token ) . ConfigureAwait ( false ) ; if ( success ) return result ; throw new InvalidOperationException ( " " ) ; } finally { linked . Dispose ( ) ; } }
Takes an item from the AsyncCollection asynchronously.
Takes an item from the AsyncCollection asynchronously .
The item removed from the collection.
The item removed from the collection .
The AsyncCollection is empty and has been marked
as complete with regards to additions.
The AsyncCollection is empty and has been marked as complete with regards to additions .
The AsyncCollection has been disposed.
The AsyncCollection has been disposed .
cancellationToken
CancellationToken