Skip to content

Instantly share code, notes, and snippets.

@Siliconrob
Forked from davidfowl/DelayCounter.cs
Created June 3, 2017 20:04
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 Siliconrob/a9cafc9a45131c431c83f1acc9af519d to your computer and use it in GitHub Desktop.
Save Siliconrob/a9cafc9a45131c431c83f1acc9af519d to your computer and use it in GitHub Desktop.
Count up from 0 to {count}, showing an item every {delay} milliseconds
public IObservable<int> ObservableCounter(int count, int delay)
{
return Observable.Range(0, count).Zip(
Observable.Interval(TimeSpan.FromMilliseconds(delay)), (item, _) => item);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment