Method Memoize
Memoize<TSource>(IAsyncEnumerable<TSource>)
Creates a sequence that lazily caches the source as it is iterated for the first time, reusing the cache thereafter for future re-iterations. By default, all sequences are cached, whether they are instantiated or lazy.
Declaration
public static IAsyncBuffer<TSource> Memoize<TSource>(this IAsyncEnumerable<TSource> source)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | The source sequence. |
Returns
| Type | Description |
|---|---|
| IAsyncBuffer<TSource> | Returns a sequence that corresponds to a cached version of the input sequence. |
Type Parameters
| Name | Description |
|---|---|
| TSource | Type of elements in |
Remarks
The returned IAsyncBuffer<T> will cache items from source in a thread-safe
manner. The sequence supplied in source is not expected to be thread-safe but it is required
to be thread-agnostic.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|