title: C# How to add List of string to a list
body: <p>I am trying to add a <code>list of string</code> to a <code>list</code>. Following is my code  </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  
      public class Program
      {
          public static void Main()
          {
              List&lt;string&gt; customBindingRow = new List&lt;string&gt;();
              List&lt;List&lt;string&gt;&gt; customBindingData = new List&lt;List&lt;string&gt;&gt;();
              for (int i = 0; i &lt; 10; i++)
              {
                  customBindingRow.Clear();
                  for (int j = 0; j &lt; 2; j++)
                  {
                      customBindingRow.Add("i=" + i.ToString() + "j=" + j.ToString());
                  }
  
                  customBindingData.Add(customBindingRow);
              }
  
              string text = "";
              foreach (List&lt;string&gt; dt in customBindingData)
              {
                  text += string.Join(",", dt.ToArray()) + "\r\n";
              }
  
              Console.WriteLine(text);
          }
      }  
  </code></pre>
  
  <p>But when I <code>Console.WriteLine</code> it is showing only the last added <code>list</code>. </p>
  
  <p><strong>Here is the output</strong>  </p>
  
  <pre><code>i=9j=0,i=9j=1
  i=9j=0,i=9j=1
  i=9j=0,i=9j=1
  i=9j=0,i=9j=1
  i=9j=0,i=9j=1
  i=9j=0,i=9j=1
  i=9j=0,i=9j=1
  i=9j=0,i=9j=1
  i=9j=0,i=9j=1
  i=9j=0,i=9j=1  
  </code></pre>
  
  <p><strong>Expected output</strong>  </p>
  
  <pre><code>i=0j=0,i=0j=1
  i=1j=0,i=1j=1
  i=2j=0,i=2j=1
  i=3j=0,i=3j=1
  i=4j=0,i=4j=1
  i=5j=0,i=5j=1
  i=6j=0,i=6j=1
  i=7j=0,i=7j=1
  i=8j=0,i=8j=1
  i=9j=0,i=9j=1
  </code></pre>