Class MessageAsyncEnumerable<T>
- Namespace
- Savvyio.Messaging
- Assembly
- Savvyio.Messaging.dll
Exposes an enumerator that provides asynchronous iteration over values of a specified type.
public class MessageAsyncEnumerable<T> : IAsyncEnumerable<IMessage<T>> where T : IRequest
Type Parameters
T
The type of the elements in the collection.
- Inheritance
-
ObjectMessageAsyncEnumerable<T>
- Implements
-
IAsyncEnumerable<IMessage<T>>
Constructors
MessageAsyncEnumerable(IAsyncEnumerable<IMessage<T>>, Action<MessageAsyncEnumerableOptions<T>>)
Initializes a new instance of the MessageAsyncEnumerable<T> class.
public MessageAsyncEnumerable(IAsyncEnumerable<IMessage<T>> source, Action<MessageAsyncEnumerableOptions<T>> setup = null)
Parameters
source
IAsyncEnumerable<IMessage<T>>The sequence to iterate.
setup
Action<MessageAsyncEnumerableOptions<T>>The MessageAsyncEnumerableOptions<T> which may be configured.
Exceptions
- System.ArgumentNullException
source
cannot be null.- ArgumentException
setup
failed to configure an instance of MessageAsyncEnumerableOptions<T> in a valid state.
MessageAsyncEnumerable(IEnumerable<IMessage<T>>, Action<MessageAsyncEnumerableOptions<T>>)
Initializes a new instance of the MessageAsyncEnumerable<T> class.
public MessageAsyncEnumerable(IEnumerable<IMessage<T>> source, Action<MessageAsyncEnumerableOptions<T>> setup = null)
Parameters
source
IEnumerable<IMessage<T>>The sequence to iterate.
setup
Action<MessageAsyncEnumerableOptions<T>>The MessageAsyncEnumerableOptions<T> which may be configured.
Methods
GetAsyncEnumerator(CancellationToken)
Returns an enumerator that iterates asynchronously through the collection.
public virtual IAsyncEnumerator<IMessage<T>> GetAsyncEnumerator(CancellationToken cancellationToken = default(CancellationToken))
Parameters
cancellationToken
CancellationTokenA System.Threading.CancellationToken that may be used to cancel the asynchronous iteration.
Returns
- IAsyncEnumerator<IMessage<T>>
An enumerator that can be used to iterate asynchronously through the collection.