开发者

How to create XDocument from XML file embedded resource

My class library has a folder called 'Foo' containing an XML file called 'Bar.xml' whose Build Action is set to Embedded Resource.

I would like to create an XDocument from this file.

How hard can it be?

(Answer: hard开发者_Go百科 enough to stump me for the last half an hour.)


What have you tried so far?! This is normally the way i do it

var manager = new ResourceManager("name.to.my.resource.set", Assembly.GetExecutingAssembly());

using (var s = manager.GetStream("myDoc"))
{
   return XElement.Load(s);
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜