I have used Observable.Using with methods that return an IDisposable in the way:
Observable.Using(() => new Stream(), s => DoSomething(s));
But how would we proceed when the stream is created asynchronously? Like in this:
Observable.Using(async () => await CreateStream(), s => DoSomething(s));
async Task<Stream> CreateStream()
{
...
}
DoSomething(Stream s)
{
...
}
This doesn't compile because it says that s is Task<Stream> instead a Stream.
What's the deal?