title: How to get out of while loop at the end of String in c#
body: <p>I have a String which is mentioned below i am extracting a 2D array from this string (which i am doing successfully) The problem is that I dont know how to exit the while loop.</p>
  
  <pre><code>00000000,00000000,10100111,10100101,11111101,11111111,00000111,00000000,
  00000000,00000000,11100010,00100010,11111111,11111111,00000000,10000000,
  00000000,00000000,00001001,00001000,00111111,00111111,00000000,00000000,
  00100000,00100000,10101110,10100010,10111110,10111110,00000000,00001000,
  00000000,00111000,00100011,01111110,01111111,01000011,01000000,01111000,
  00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,
  00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,
  </code></pre>
  
  <p>I tried to put "x" at the end of string  and ran my while loop like this and it works but Its not feasible for me beacuase I have to read this string from like hundreds of files. </p>
  
  <pre><code>while (Data_string[counter] !=  'x' )
  {
      while (Data_string[counter] != ',')
      {
          if (Data_string[counter] != '\n')
              SubString += Data_string[counter];
  
          counter++;
      }
      // here I use Substring to covert to int and then set Substring to empty string
  }
  </code></pre>
  
  <p>So I am looking for an efficient solution so i dont have to alter the string,</p>
  
  <p>Thanks..</p>