Skip to content

Instantly share code, notes, and snippets.

@ohager
Created November 29, 2018 23:11
Show Gist options
  • Save ohager/6ff54be9b286be9f59d0c93e4f807643 to your computer and use it in GitHub Desktop.
Save ohager/6ff54be9b286be9f59d0c93e4f807643 to your computer and use it in GitHub Desktop.
.Net.Reactive meets C#7
Observable.Timer(new TimeSpan(0, 0, 1))
.Do(async _ => await _service.ReserveToCommit(ConsumerIdentification.ConsumerId))
.SelectMany(async _ => await _service.GetNewItemToCommit(ConsumerIdentification.ConsumerId))
.Where(guid => guid != Guid.Empty)
.SelectMany(async guid => (userGroup: await _userGroupStagingService.GetWithAllChilds(guid), guid: guid))
.Where(tuple => tuple.userGroup.Success)
.Subscribe(tuple =>
{
// ... do some stuff
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment