May 5th, 2010, 09:04 AM
How to read a Resourced file?
my previous question about reading Resource Assembly info was greatly honoured and solved.
but I'v encountered another issue.
I simply access an .xml file from my application.
But after publishing and installing my application it misses my xml file....
So thinking being smart (;-)) I added this .xml file as a resource to my solution.
But now I wonder how I programatically should access this xml file from the resource.
May 5th, 2010, 11:16 AM
Re: How to read a Resourced file?
Just let me answer myself... ;-)
When accessing a resource which is an xml file then it will return a STRING to the CONTENTS of the resourced xml file.
So to get the xml contents we need:
string s = MyNameSpace.Properties.Resources.MyXmlFileName;
To convert the data to an internal computer memory XML document we do:
XmlDocument.InnerXml = s;
thanks for listening anyway.
Click Here to Expand Forum to Full Width