title: How do I convert an array of floats to a byte[] and back?
body: <p>I have an array of Floats that need to be converted to a byte array and back to a float[]... can anyone help me do this correctly?  </p>
  
  <p>I'm working with the bitConverter class and found myself stuck trying to append the results.</p>
  
  <p>The reason I'm doing this is so I can save runtime values into a IO Stream.  The target storage is Azure Page blobs in case that matters.  I don't care about what endian this is stored in, as long as it input matches the output.</p>
  
  <pre><code>static  byte[] ConvertFloatToByteArray(float[] floats)
          {
              byte[] ret = new byte[floats.Length * 4];// a single float is 4 bytes/32 bits
  
              for (int i = 0; i &lt; floats.Length; i++)
              {
                 // todo: stuck...I need to append the results to an offset of ret
                  ret = BitConverter.GetBytes(floats[i]);
  
              }
              return ret;
          }
  
  
   static  float[] ConvertByteArrayToFloat(byte[] bytes)
  { //to do }
  </code></pre>