title: Use Html.DisplayFor in custom HtmlHelper
body: <p>I have a custom HtmlHelper extension and I need to use Html.DisplayFor inside this helper. How is it possible to use it like in a view?</p>
  
  <p>I have entities, all of them inherit from BaseEntity which has Id, CreatedOn etc...</p>
  
  <pre><code>public class BaseEntity
  {
      [Key]
      public long Id { get; set; }
  
      [Display(Name = "Created On"), DisplayFormat(DataFormatString = "{0:dd.MM.yyyy HH:mm}")]
      public DateTime CreatedOn { get; set; }
  
      [Display(Name = "Updated On"), DisplayFormat(DataFormatString = "{0:dd.MM.yyyy HH:mm}")]
      public DateTime? UpdatedOn { get; set; }
  }
  </code></pre>
  
  <p>Helper:</p>
  
  <pre><code>public static class InfoExtensions
  {
      public static IHtmlString Info(this HtmlHelper helper, BaseEntity m)
      {
          var sb = new StringBuilder();
  
          sb.Append($"{Html.DisplayNameFor(m.CreatedOn)}: {Html.DisplayFor(m.CreatedOn)}");
          sb.Append($"{Html.DisplayNameFor(m.UpdatedOn)}: {Html.DisplayFor(m.UpdatedOn)}");
  
          return new HtmlString(result.ToString());
      }
  }
  </code></pre>
  
  <p>I'm trying to output a html result like:</p>
  
  <pre><code>Created On: 15.04.2017 13:28
  Updated On: 18.04.2017 15:36
  </code></pre>