title: Building Html in Html Helper using Razor or Tag builder?
body: <p>I am building a Html Helper in MVC 4 and I want to know how to build tags / html in the html helpers properly. </p>
  
  <p>For example here is simple html helper that creates image tag using <code>TagBuilder</code> class:</p>
  
  <pre><code>public static MvcHtmlString Image(this HtmlHelper html, string imagePath, 
      string title = null, string alt = null)
  {
      var img = new TagBuilder("img");
      img.MergeAttribute("src", imagePath);
      if (title != null) img.MergeAttribute("title", title);
      if (alt != null) img.MergeAttribute("alt", alt);
  
      return MvcHtmlString.Create(img.ToString(TagRenderMode.SelfClosing));
  }
  </code></pre>
  
  <p>From another side I can do something like this:</p>
  
  <pre><code>// C#:
  public static MvcHtmlString Image(this HtmlHelper html, string imagePath, 
      string title = null, string alt = null)
  {
      var model = new SomeModel() {
          Path = imagePath,
          Title = title,
          Alt = alt
      };
  
      return MvcHtmlString.Create(Razor.Parse("sometemplate.cshtml", model));
  }
  
  // cshtml:
  &lt;img src="@model.Path" title="@model.Title" alt="@model.Alt" /&gt;
  </code></pre>
  
  <p>Which is the better solution?</p>