使用URI时保存XML文件 [英] Save XML File when you are using URI

查看:69
本文介绍了使用URI时保存XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有用来打开它的XML文件,

Hi all,

i have XML file i used to open it like,

XmlDocument doc = new XmlDocument();
doc.Load(Application.GetResourceStream(new Uri("pack://application:,,,/Ribbon.xml")).Stream);


但是此流是只读的,我无法在其上写,

真正的问题是如何在我没有他完整路径的文件上写东西,我只是拥有他的Uri,而我在Google上搜索它却没有找到任何解决方法,请帮助


but this stream is read only, i can''t write on it,

the real problem is how to write on a file that i haven''t his full path i just have his Uri, and i google for it and don''t found any solution please help

推荐答案

它不是一个单独的文件,而是嵌入到可执行文件中的资源.
It''s not a separate file, it''s a resource embedded into your executable.
doc.Load(Application.GetResourceStream(new Uri("pack://application:,,,/Ribbon.xml")).Stream);



最好的问候
Espen Harlinn



Best regards
Espen Harlinn


首先,您必须对内容文件进行构建操作,然后使用
first you have to to make the Build Action for the file Content then use the
Environment.CurrentDirectory


获得项目路径.那么您可以轻松地使用该文件(读,写,...)

谢谢大家.


to get the project path. then you can use the file easily (Read, Write,...)

Thanks All.


这篇关于使用URI时保存XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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