title: Delete last char of string
body: <p>I am retrieving a lot of information in a list, linked to a database and I want to create a string of groups, for someone who is connected to the website.</p>
  
  <p>I use this to test but this is not dynamic, so it is really bad:</p>
  
  <pre><code>string strgroupids = "6";
  </code></pre>
  
  <p>I want to use this now. But the string returned is something like <code>1,2,3,4,5,</code></p>
  
  <pre><code>groupIds.ForEach((g) =&gt;
  {
      strgroupids = strgroupids  + g.ToString() + ",";
      strgroupids.TrimEnd(',');
  });
  
  strgroupids.TrimEnd(new char[] { ',' });
  </code></pre>
  
  <p>I want to delete the <code>,</code> after the <code>5</code> but it's definitely not working.        </p>