title: StringBuilder extension method for appending a collection in C#
body: <p>In C#, I'm trying to build an extension method for StringBuilder called AppendCollection() that would let me do this:</p>
  
  <pre><code>var sb1 = new StringBuilder();
  var sb2 = new StringBuilder();
  var people = new List&lt;Person&gt;() { ...init people here... };
  var orders = new List&lt;Orders&gt;() { ...init orders here... };
  
  sb1.AppendCollection(people, p =&gt; p.ToString());
  sb2.AppendCollection(orders, o =&gt; o.ToString());
  
  string stringPeople = sb1.ToString();
  string stringOrders = sb2.ToString();
  </code></pre>
  
  <p>stringPeople would end up with a line for each person in the list.  Each line would be the result of p.ToString().  Likewise for stringOrders.  I'm not quite sure how to write the code to make the lambdas work with generics.</p>