title: Resizing and initializing 2D array C#
body: <p>I have a 2D array of type <code>string</code> which I want to modify and resize inside some loop. My main goal is to use minimum memory by creating a 2d array which will be modified every iteration of loop and the add a char to an appropriate cell in this array. Here is my code: </p>
  
  <pre><code>static void Main(string[] args)
      {
          int maxBound = 100;//length of freq array
          Random rnd1 = new Random();
          int numLoops = rnd1.Next(1000, 1200);//number of total elements in freq array
          int[] freq = new int[maxBound];//freq array
          string[,] _2dim = new string[maxBound, numLoops];//rows,columns
          Random rnd2 = new Random();
  
          for (int i = 0; i &lt; numLoops; i++)
          {
              int s = rnd2.Next(maxBound);
              freq[s]++;
              //Here I try to add `*` to the _2dim array while resizing it to the appropriate size
  
          }
      } 
  </code></pre>
  
  <p>What is the main approach for the solution ? Thanks</p>