Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading xml file from a resource

I am trying to load an xml file that is stored as a resource in my C# project so I can perform various LINQ queries. However at runtime an "Illegal characters in path" exception is thrown. This is how I am loading the file:

XDocument doc = XDocument.Load(MyProject.Properties.Resources.XMLFile);
like image 539
jwarzech Avatar asked Dec 03 '08 15:12

jwarzech


1 Answers

Wouldn't XMLFile here actually return the xml itself? If so:

XDocument doc = XDocument.Parse(MyProject.Properties.Resources.XMLFile);
like image 101
Marc Gravell Avatar answered Sep 22 '22 15:09

Marc Gravell