Is there a way to convert a System.IO.Stream to a Windows.Storage.Streams.IRandomAccessStream?

后端 未结 7 944
暖寄归人
暖寄归人 2020-11-30 00:42

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

7条回答
  •  清歌不尽
    2020-11-30 01:06

    Take a look to this link:

    How To Convert Byte Array To IRandomAccessStream

    It also gives examples and an implementation of a byte array constructor (and one for .NET streams), useful if you want to use the SetSource or SetSourceAsync methods of BitmapImage class (as in my case).

    Hope this helps someone...

提交回复
热议问题