I have an xml file, currently external to the C# code and it is loaded like this:
var xElem = XElement.Load("ProductTable.xml");
How do I “use” this file as an “embedded” element in my C# code instead of having it as an external file?
I know I am not clear enough with the words “use” and “embedded”. What I want to do is to use it as some kind of variable such as
var myXML = /* content of the XML file here */;
just so that I don’t have to use an external xml file. Thanks.
You have a resources file in your project. Just dragNdrop it there and you will be able to access it.
Another way is to add this file to project, then click properties, set compile method to emedded and then do smth like this