开发者

Use markup file inside assembly

开发者 https://www.devze.com 2023-01-23 11:10 出处:网络
How i can open an xml or xsl file inside the same a开发者_开发知识库ssembly from source code in C#?

How i can open an xml or xsl file inside the same a开发者_开发知识库ssembly from source code in C#? Any ideas?


Google found this

using System;
using System.IO;
using System.Reflection;
using System.Xml;

class Application
{
    static void Main(string[] args) 
    {
       Stream s = 
          Assembly.GetExecutingAssembly().GetManifestResourceStream("File1.xml");

       XmlDocument xdoc = new XmlDocument();

       using (StreamReader reader = new StreamReader(s))
           xdoc.LoadXml(reader.ReadToEnd());
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消