Home > C#, C# Snippets, WinForms > C#: Reading embedded XML file

C#: Reading embedded XML file

13:04

Marek Śliwiński Leave a comment Print This Post  (137) Go to comments

Snippet:

Assembly assembly = Assembly.GetExecutingAssembly();

string filePath = assembly.GetName().Name + ".filename.xml";

using (Stream stream = assembly.GetManifestResourceStream(filePath))
{
    if (stream != null)
    {
      // do something with Stream from file
    }
}
Share and Enjoy:
  • DotNetKicks
  • Digg
  • del.icio.us
  • Wikio IT
  • Google Bookmarks
  • Facebook
  • Print
Categories: C#, C# Snippets, WinForms Tags:
  1. No comments yet.
  1. No trackbacks yet.

Subscribe without commenting