In Windows 8; I would like to pass the contents of a MemoryStream to a class that accepts a parameter of type Windows.Storage.Streams.IRandomAccessStream. Is there any way t
This code snippet turns a stream (stream) into an InMemoryRandomAccessStream (ims) which implement IRandomAccessStream. The trick is that CopyTo has to be called on a background thread.
InMemoryRandomAccessStream ims = new InMemoryRandomAccessStream();
var imsWriter = ims.OpenWrite();
await Task.Factory.StartNew(() => stream.CopyTo(imsWriter));