title: Razor view engine automatically applying quotes?
body: <p>I'm fairly used to razor now, but I can't understand why the following syntax is correct?</p>
  
  <pre><code>&lt;li @(active ? "class=active" : "")&gt;
     @Html.ActionLink(item.Text, item.TargetAction, Model.Controller)
  &lt;/li&gt;
  </code></pre>
  
  <p>As you can see I'm conditionally applying a class (and I've written it this way so the class tag is not generated if the bool active == false).</p>
  
  <p>What I can't understand is why this then generates the correct quotes to give:</p>
  
  <pre><code>&lt;li class="active"&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/li&gt;
     &lt;a href="/"&gt;Home&lt;/a&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>Somehow it is magically sorting out the quoting, but I can't find any reference in the articles on razor to suggest this is expected, so I'm wondering if it is relying on broken behaviour. If I add single or double quotes into the string around the word 'active', as you would expect to if cranking out html, I end up with:</p>
  
  <pre><code>&lt;li class="'active'"&gt;
      &lt;a href="/"&gt;Home&lt;/a&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;li class=&amp;quot;active&amp;quot;&gt;
      &lt;a href="/"&gt;Home&lt;/a&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>Why does it work this way, and is my code correct (as opposed to simply functioning)?</p>