Daniel Lo Nigro
Daniel Lo Nigro

Reputation: 3424

Rx .NET: ToTask vs LastAsync vs RunAsync

Reactive Extensions has these three methods:

They sound very similar. How would I choose which one to use?

Upvotes: 4

Views: 870

Answers (1)

Andrii Litvinov
Andrii Litvinov

Reputation: 13182

You should choose based on what you want to do with returning value, as these methods have different return types with different capabilities. If you only want to await last result you can use any of the methods above as they provide same behavior in this case. They all handle empty observable collections and exceptions when awaited.

Upvotes: 1

Related Questions