6

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);
jwarzech
  • 6,506
  • 11
  • 50
  • 71

1 Answers1

14

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

XDocument doc = XDocument.Parse(MyProject.Properties.Resources.XMLFile);
Marc Gravell
  • 976,458
  • 251
  • 2,474
  • 2,830