title: In C#: Add Quotes around string in a comma delimited list of strings
body: <p>This probably has a simple answer, but I must not have had enough coffee to figure it out on my own:</p>
  
  <p>If I had a comma delimited string such as:</p>
  
  <pre><code>string list = "Fred,Sam,Mike,Sarah";
  </code></pre>
  
  <p>How would get each element and add quotes around it and stick it back in a string like this:</p>
  
  <pre><code>string newList = "'Fred','Sam','Mike','Sarah'";
  </code></pre>
  
  <p>I'm assuming iterating over each one would be a start, but I got stumped after that.</p>
  
  <p>One solution that is ugly:</p>
  
  <pre><code>int number = 0;
  string newList = "";
  foreach (string item in list.Split(new char[] {','}))
  {
      if (number &gt; 0)
      {
          newList = newList + "," + "'" + item + "'";
      }
      else
      {
          newList = "'" + item + "'";
      }
      number++;
  }
  </code></pre>