Skip to content

Instantly share code, notes, and snippets.

@jonstodle
Created March 21, 2017 11:39
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 jonstodle/ad333e5a944104276998abde2027ce5f to your computer and use it in GitHub Desktop.
Save jonstodle/ad333e5a944104276998abde2027ce5f to your computer and use it in GitHub Desktop.
Console.WriteLine("Starting on thread ".PadLeft(26) + Thread.CurrentThread.ManagedThreadId.ToString());
Func<Unit> writeLineAndReturnUnit = () =>
{
Console.WriteLine($"Inside Return on thread ".PadLeft(26) + Thread.CurrentThread.ManagedThreadId.ToString());
return Unit.Default;
};
Observable.Return(writeLineAndReturnUnit(), TaskPoolScheduler.Default)
.Do(_ => Console.WriteLine("Passing through on thread ".PadLeft(26) + Thread.CurrentThread.ManagedThreadId.ToString()))
.Subscribe(_ => Console.WriteLine($"Received on thread ".PadLeft(26) + Thread.CurrentThread.ManagedThreadId));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment