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);
}
精彩评论