相关疑难解决方法(0)

如何读取可移植类库中的资源文件?

我有一个可移植的库,我用于Windows Phone应用程序.在同一个可移植库中,我有几个内容文件(Build Action = Content).

DataReader在Portable Library中创建了一个类,它应该向我返回一个流到内容文件.然而,下面的代码我一直取回nullGetManifestResourceStream.我究竟做错了什么?

public class DataReader
{
    public static Stream GetStream(string code)
    {
        string path = string.Format("./data/code-{0}.dat", code);
        return Assembly.GetExecutingAssembly().GetManifestResourceStream(path);
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# embedded-resource

22
推荐指数
3
解决办法
2万
查看次数

标签 统计

.net ×1

c# ×1

embedded-resource ×1