Skip to content

Instantly share code, notes, and snippets.

@GeorgDangl
Last active January 30, 2020 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeorgDangl/3e87c41e0abf3b9ec79b99d7ad8db8e0 to your computer and use it in GitHub Desktop.
Save GeorgDangl/3e87c41e0abf3b9ec79b99d7ad8db8e0 to your computer and use it in GitHub Desktop.
Cancel Obsolete Http Requests in Rx.NET with the Switch Operator, see https://blog.dangl.me/archive/cancel-obsolete-http-requests-in-rxnet-with-the-switch-operator/
_requestUrl
.Subscribe(async url =>
{
var response = await httpClient.GetAsync(url);
// Update the list
});
_requestUrl
.Select(url => httpClient.GetAsync(url))
.Switch()
.Subscribe(response =>
{
// Update the list
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment