Skip to content

Enable usage of async foreach on SF IAsyncEnumerable#470

Open
AndreyTretyak wants to merge 2 commits intomicrosoft:masterfrom
AndreyTretyak:andreyt/suport-async-foreach
Open

Enable usage of async foreach on SF IAsyncEnumerable#470
AndreyTretyak wants to merge 2 commits intomicrosoft:masterfrom
AndreyTretyak:andreyt/suport-async-foreach

Conversation

@AndreyTretyak
Copy link
Copy Markdown

@AndreyTretyak AndreyTretyak commented Apr 17, 2020

This change will allow using ServiceFabric.Data.IAsyncEnumerable<T> in the async foreach, since it uses duck typing.
So instead of manually working with enumerator we can write:

async Task SomeMethond(ServiceFabric.Data.IAsyncEnumerable<T> asyncEnumerable)
{
  await foreach(var item in asyncEnumerable)
  {
     /*  Some code that use item variable */
  }
}

This will NOT allow using the extension method of System.Collection.Generic.IAsyncEnumerable<T> like WithCancelation or ConfigureAwait in order to do that interface needs to be implemented.

This change could help with following issue #406

@AndreyTretyak AndreyTretyak marked this pull request as ready for review April 17, 2020 19:23
@AndreyTretyak
Copy link
Copy Markdown
Author

AndreyTretyak commented Apr 20, 2020

@bpm-ms @anmolah @samedder could you please have a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant