问题
In my application i am using a Rx based web request for fetching the data from the server. Suppose if i want to cancel the request, what i need to do?
回答1:
Try using the extension method TakeUntil(someEvent), before Subscribe, where SomeEvent could be an Observable.FromEventPattern fired from button click event, for example.
Let us know,
regards,
回答2:
If you're asking how to cancel the subscription to an observable that is performing the web request then all you need to do is call .Dispose()
on the disposable returned from the .Subscribe(Action action)
method.
来源:https://stackoverflow.com/questions/9990882/how-to-cancel-rx-based-web-request-in-windows-phone-7