Does anyone have a steer on when to use one of these methods over the other. They seem to do the same thing in that they convert from TPL Task
to an Observable
.
Observable.FromAsync
appear to support cancellation tokens which might be the subtle difference that allows the method generating the task to participate in cooperative cancellation if the observable is disposed.
Just wondering if I'm missing something obvious as to why you'd use one over the other.
Thanks
Observable.FromAsync
accepts a TaskFactory in the form of Func<Task>
or Func<Task<TResult>>
,
in this case, the task is only created and executed, when the observable is subscribed to.
Where as .ToObservable()
requires an already created (and thus started) Task.