title: c# - byte array improper conversion to MB
body: <p>The file is about 24mb, and it's held in a DataBase so I convert it to a bit array and then, after multiple suggestions, I use bitconverter.tosingle(,) and this is giving me bad results, here's my code:</p>
  
  <pre><code>     byte[] imgData = prod.ImageData;
  
       float myFloat = BitConverter.ToSingle(imgData, 0);
  
       float mb = (myFloat / 1024f) / 1024f;
  </code></pre>
  
  <p>When I debug, I get these results:</p>
  
  <p>byte[24786273]</p>
  
  <p>myFloat = 12564.0361</p>
  
  <p>mb = 0.0119819986</p>
  
  <p>what is weird is that he size of the array is exactly as the file should be. How do I correctly convert this to float and then so it shows as mb?</p>
  
  <p>EDIT: I tried setting up myFloat as imgData.Length, then the size is correct, however is this a correct way to do it, and can it cause a problem in the future with bigger values?</p>