title: Using a DisplayTemplate (with DisplayFor) for each item in a collection
body: <p>I have created a DisplayTemplate for a <code>Comment</code> class, and placed it inside <code>Comment/DisplayTemplates/Comment.cshtml</code>.</p>
  
  <p><code>Comment.cshtml</code> is properly typed:</p>
  
  <pre><code>@model Comment
  </code></pre>
  
  <p>Then, I have a partial view that takes an <code>IEnumerable&lt;Comment&gt;</code> for model. In there I loop through the collection and would like to use the DisplayTemplate for the <code>Comment</code> class. The view, in its integrity:</p>
  
  <pre><code>@model IEnumerable&lt;Comment&gt;
  
  @foreach (var comment in Model.Where(c =&gt; c.Parent == null)) { 
      @Html.DisplayFor(model =&gt; comment)
  }
  </code></pre>
  
  <p>However, I get an error on the <code>Html.DisplayFor</code> line:</p>
  
  <blockquote>
    <p>The model item passed into the dictionary is of type 'System.Int32', but this dictionary requires a model item of type 'System.String'.</p>
  </blockquote>
  
  <p>How can I invoke the DisplayTemplate for each item in the <code>foreach</code> loop?</p>