title: How to query an embedded XML file using LINQ?
body: <p><strong>[C# .NET 4.0 WinForm LINQ]</strong></p>
  
  <p>I had an XML file that I added to my project as <code>Content</code>, but I'm now having to make it an internal, embedded resource so it will compile with the executable and I won't have to create an install/deployment package for the app. </p>
  
  <p>However, I have existing code that uses LINQ to query the XML file that won't work now that I've made the file an embedded resource. <strong>What do I need to do differently to be able to query the XML file if it's an embedded resource compared to when it's a content resource?</strong> I've seen some</p>
  
  <p>Once I query the XML file, I loop through the results and load them into a list box. Here's the code I'm using to query the XML file when it's set to <code>Content</code> and my loop to add to the listbox:</p>
  
  <pre><code>var computers = from e in XElement.Load(@"MyXML.xml").Elements("computer")
          select (string)e.Element("name");
  
  foreach (var c in computers)
  {
      if (!IsNullOrEmpty(computer))
      {
          lstComputer.BeginUpdate();
          lstComputer.Items.Add(computer);
          lstComputer.EndUpdate();
      }
  }
  </code></pre>
  
  <p>I've seen some other examples, like <a href="https://stackoverflow.com/questions/2820384/reading-embedded-xml-file-c-sharp">this one</a>, that use the assembly to read the file into a string...is this what I would have to do? Not to further reveal my inner noob, but if that's the case, does the example in the link above return a delimited string that I can loop through so I can add the items to my listbox?</p>
  
  <p>Thanks...</p>