title: c# read byte array from resource
body: <p>I've been trying to figure out how to read a byte array from one of my resource files, I have tried the most popular hits on Google without clear success.</p>
  
  <p>I have a file stored in the resource collection of my program, I'd like to read this file as a byte array</p>
  
  <p>I'm currently just reading the file from the root directory of my program with the following code:</p>
  
  <pre><code>FileStream fs = new FileStream(Path, FileMode.Open);
  BinaryReader br = new BinaryReader(fs);
  byte[] bin = br.ReadBytes(Convert.ToInt32(fs.Length));
  fs.Close();
  br.Close();
  </code></pre>
  
  <p>However I want to store this file as a resource in my application, so that I don't have to ship an extra file with my program.</p>
  
  <p>This file holds encrypted data that part of my program uses.</p>
  
  <p>Any help or pointers would be greatly appreciated!</p>