title: Why does Html.DisplayFor work when not in an IF statement?
body: <p>I have this bit of code in my MVC view:</p>
  
  <pre><code>&lt;div style=""&gt;
      @Html.DisplayFor(modelItem =&gt; item.ContentResourceFile.FileName)
      @if (item.ContentResourceFile != null &amp;&amp; !string.IsNullOrEmpty(item.ContentResourceFile.FileName))
      {
          Html.DisplayFor(modelItem =&gt; item.ContentResourceFile.FileName);
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>The first DisplayFor of FileName works it renders out in the results, but the one in the IF statement does not render out.</p>
  
  <p>Can somebody explain why?</p>