title: Split DataTable Values(Comma Separated Values) Into multiple rows
body: <p>I'm having a problem with my code which is the following example.</p>
  <p>I have the following example data:</p>
  <p><strong>DataTable with 2 columns</strong></p>
  <pre><code>Fruits         FruitGroup
  
  Banana         FG1,FG2,FG5
  Apple            
  Melon          FG1,FG6,FG11
  </code></pre>
  <p>My Expected Outcome has to be this.</p>
  <pre><code>Fruits         FruitGroup
  
  Banana         FG1
  Banana         FG2
  Banana         FG5
  Apple          NA
  Apple          NA 
  Apple          NA 
  Melon          FG1
  Melon          FG6
  Melon          FG11
  </code></pre>
  <p>This is my most recent failed attempt which I found here on Stack Overflow.</p>
  <pre><code>var tblfruitflat = fruitTable.Clone();
  foreach (DataRow row in fruitTable.Rows)
  {
      string frutas = row.Field&lt;string&gt;(&quot;Fruit&quot;);
      string frutasGroup = row.Field&lt;string(&quot;FruitGroup&quot;).Split(',');
      for (int ir = 0; ir &lt; frutasGroup.Length; ir++)
      {
          var newRow = tblfruitflat.Rows.Add();
          newRow.SetField(&quot;Fruits&quot;, frutas[ir]);
          newRow.SetField(&quot;FruitGroup&quot;, fruitGroup.ElementAtOrDefault(ir));
  
      }
  }
  </code></pre>
  <p>Have to mention that I can have empty strings in my FruitGroup column which must be &quot;NA&quot;.
  I'm lost in how to approach this.</p>
  <p>Code Snippet Thanks To @Tim Schmelter</p>