title: Best way to write a 3d int Array to file (and update it)?
body: <p>I'm trying to save a 3d array to file in a format that can be easily retrieved and updated. I'm not having much luck in finding a simple way to do it.</p>
  
  <p>it's an int array with 3 dimensions. I'd prefer a save method that resembles something like this:</p>
  
  <pre><code>//save
  for (int z1 = 0; z1 &lt;= z; z1++)
  {
    for (int c = 0; c &lt; m.Length; c++)
    {
      for (int x = 0; x &lt; 4; x++)
      {
        writeToFile("matrix.txt", matrix[z1][c][x];
      }
    }
  }
  </code></pre>
  
  <p>and a similar retrieval method, but at this point I'm not at all picky, anything that will save to file and be easily retrieved is fine. </p>
  
  <p>the above is only preferred as it would allow me to save just the portion of the array that hold data.</p>
  
  <p>the size of the array is something like m[4000][7000][4] but it's sparsely populated.</p>
  
  <p>EDIT: After making longer runs it turns out my machine is not capable of running an array of this size so I will be switching to an xml data set instead. Thank you all for your suggestions, sorry I can't better implement them. </p>