title: How to include HTML document in .NET application with variable fields?
body: <p>I have a C#/.NET app which currently uses StringBuilder to generate an HTML email message.</p>
  
  <p>A new message format has been developed and now includes more formatting and CSS. I'd like to avoid appending each line of the file using StringBuilder, so I thought it best to include the HTML file as a resource.</p>
  
  <p>However, there are about 21 variables within the CSS and HTML which I need to change on the fly. My first thought was to replace them with the standard String.Format placeholders ({0}, {1} etc) but when viewing the HTML, validation complains about these.</p>
  
  <p>I'm rather stumped as to what the best practice is for storing a 200-line HTML file and changing parts of it before inclusion in an email.</p>
  
  <p>Example:</p>
  
  <p>Within the CSS, I need to change the color of certain elements, like this:</p>
  
  <pre><code>#header
  {
      background-color: {0};
  }
  </code></pre>
  
  <p>And within the HTML, I need to change strings and URLs, like this:</p>
  
  <pre><code>&lt;img src="{1}" /&gt;
  &lt;span&gt;{2}&lt;/span&gt;
  </code></pre>
  
  <p>It seems including the HTML as a resource in the project would be best, but trying to use String.Format with that resource, regardless if it would work, is a poor method because of the aforementioned validation errors.</p>
  
  <p>Any suggestions?</p>