Skip to content

Add built-in support for handling output from an async enumerator #20

@jhickson

Description

@jhickson

Possible interface

public interface IActor
{
    /* ... */

   Task Enumerate<T>(IAsyncEnumerator<T> enumerator, Action<T> currentValueHandler, Action completionHandler = null);

   Task Enumerate<T>(IAsyncEnumerator<T> enumerator, Func<T, Task> currentValueAsyncHandler, Action completionHandler = null);
}

Usage

IAsyncEnumerator<int> enumerator = /* .... */;

_actor.Enumerate(enumerator, current => {}, () => {});

Notes

  • Need to handle case where completionHandler is actually marked as async - i.e. it's really of type Func<Task>.
  • Is Enumerate the best name?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions