“流不可写";例外 [英] "Stream was not writable" exception

查看:392
本文介绍了“流不可写";例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我使用此代码写入Resx嵌入式文件.

Hello

I used this code for write to Resx embedded file.

Assembly assembly = Assembly.LoadFrom(@"ClassLibrary2.dll");
Stream stream = assembly.GetManifestResourceStream(@"ClassLibrary2.defualt.resources");

ResourceWriter rw = new ResourceWriter(stream);
rw.AddResource("welcomeString", "www.navioo.com");
rw.Generate();
rw.Close();


但是当我运行它时,我看到一个错误.此错误是:


but when I run it I watch an error . this error is :

Stream was not writable.


请帮助我.


pleas help me.

推荐答案

清单资源流是只读的,无法以这种方式写入.

参见以下内容:http://www.c-sharpcorner.com/uploadfile/yougerthen/handle-resource-files-read-and-write-into-a-resource-file-programmatically-part-iv/ [ ^ ]
Manifest resource streams are readonly and cannot be written to this way.

See the following : http://www.c-sharpcorner.com/uploadfile/yougerthen/handle-resource-files-read-and-write-into-a-resource-file-programmatically-part-iv/[^]



请参阅下面的链接以获取类似的线程:
流不可写异常的可能原因? [ ^ ]
读取后无法写入文件 [ ^ ]
https://groups.google.com/forum/?fromgroups=#!topic/dotnetdevelopment/r-s7PHfOiPc [ ^ ]


--Amit
Hi,
Refer the links below for the similar threads:
possible causes for stream not writable exception?[^]
Cannot write to file after reading[^]
https://groups.google.com/forum/?fromgroups=#!topic/dotnetdevelopment/r-s7PHfOiPc[^]


--Amit


这篇关于“流不可写";例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆