c# - 将流转换为 IRandomAccessStream

标签 c# .net windows-store-apps win-universal-app

我需要将 Stream 转换为 IRandomAccessStream(以便创建 BitmapDecoder)。我尝试在 BitmapDecoder 中为其转换和搜索内置方法,但找不到任何方法。

那我该怎么做呢?

最佳答案

有一个扩展方法:

Stream stream = GetSomeStream();
IRandomAccessStream randomAccessStream = stream.AsRandomAccessStream();

只需确保您的代码文件顶部有 using System.IO

关于c# - 将流转换为 IRandomAccessStream,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33221083/

相关文章:

.net - F# 基础知识 : turning NameValueCollection into nice string

c# - 从 XmlWriter.WriteStartElement 中排除命名空间时出现问题

c# - 如何覆盖 App.cs 中的 OnFileActivated 事件以使 OpenWith 正常工作

c# - 通过在 Windows 窗体中按回车键提交

c# - 将任意 ID 附加到 Google 联系地址

c# - 在任何应用程序中持久层有什么用?

cryptography - 在我的应用程序中使用加密技术会限制其可用性吗?

c# - 如何在 ASP.NET Core 2.0 MVC 中为 GET 和 POST 请求添加单独的默认路由?

c# - Geolocator.RequestAccessAsync 方法

c# - 尝试从转储文件中调试 Windows Store App