title: Read a file compile-time in C#
body: <p>I am writing some unit tests in which I need a fake xml file. I can create that file and require it to be deployed with the unit tests, but experience shows that at my office it's a lot of headache. So I decided that the file will be created by UT's.</p>
  
  <pre><code>StreamWriter sw = new StreamWriter(testFileName);
  sw.Write(contents);
  sw.Close();
  </code></pre>
  
  <p>Now the problem is the contents string. It is virtually a long xml, something like this:</p>
  
  <pre><code>string contents = 
  @"&lt;?xml version="1.0" encoding="windows-1251"?&gt;
    &lt;blah&gt;
    ~100 lines here
    &lt;/blah&gt; ";
  </code></pre>
  
  <p>I don't want this to be in the same file as the rest of the code. I want the string to be generated compile-time from a file.</p>
  
  <p>In C++, I'd do this</p>
  
  <pre><code>string contents = "
  #include "test.xml"
     ";
  </code></pre>
  
  <p>Is it possible somehow in C#?      </p>