title: C# convert 1D array to 2D
body: <p>I find myself converting 1D byte and single arrays to 2D by doing the following. I suspect it is probably as fast as other methods, but perhaps there is a cleaner simpler paradigm? (Linq?)</p>
  
  <pre><code>    private static byte[,] byte2D(byte[] input, int height, int width)
      {
          byte[,] output = new byte[height, width];
          for (int i = 0; i &lt; height; i++)
          {
              for (int j = 0; j &lt; width; j++)
              {
                  output[i, j] = input[i * width + j];
              }
          }
          return output;
      }
  
      private static Single[,] single2D(byte[] input, int height, int width)
      {
          Single[,] output = new Single[height, width];
          for (int i = 0; i &lt; height; i++)
          {
              for (int j = 0; j &lt; width; j++)
              {
                  output[i, j] = (Single)input[i * width + j];
              }
          }
          return output;
      }
  </code></pre>