title: Code optimisation for foreach in C#
body: <p>Code:</p>
  
  <pre><code>string testquestions = "1,2,100,3,4,101,98,99";
  string[] qidarray = testquestions.Split(',');
  
  StringBuilder sb = new StringBuilder();
  
  foreach (string s in qidarray)
  {
      sb.Append(String.Format(@"({0}),",s));
  }
  
  string output= sb.ToString().Substring(0, sb.ToString().Length - 1);
  </code></pre>
  
  <p>Desired output = </p>
  
  <pre><code>(1),(2),(100),(3),(4),(101),(98),(99)
  </code></pre>
  
  <p>The code works. I want to know is this the best way for achieving the result. Is there a better way to achieve the desired result?</p>
  
  <p>Is there a way not to use a <code>foreach</code> loop?</p>