float array to byte array

C

Cory Autry

What is the best way to convert a array of floats to a byte array, or at
least have the ADO dataset assignment operator see the array as a byte
array.

Thanks,
Jim
 
A

Austin Ehlers

/*untestede code*/

int len=floatarray.Length;
byte[] bytes=new byte[len];
int x=0;
foreach(float f in floatarray)
{
byte[] t=BitConverter.GetBytes(f);
for(int y=0;y<4);y++)
bytes[y+x]=t[y];
x+=4;
}

That *should* compile.

Austin Ehlers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top