c# - Convert from hexadecimal to float -


i have string array has hexadecimal values in it. want convert float array. tried code below doesn't give me correct results:

bufferarray string array contains hexadecimal values.

float[] dblbffrarry = new float[bufferarray.length];  (int = 0; < bufferarray.length; i++) {     long parsed = long.parse(bufferarray[i], numberstyles.allowhexspecifier);     dblbffrarry[i] = parsed; } 

can point way it?

maybe like:

float[] floatbffrarry = bufferarray.select(s => convert.toint64(s, 16))     .select(i => (float)i).toarray(); 

edit:

a different interpretation of ask is:

float[] floatbffrarry6 = bufferarray.select(s => convert.touint64(s, 16))     .select(i => bitconverter.tosingle(bitconverter.getbytes(i), 0)).toarray(); 

it's hard know want when don't give examples of inputs , outputs.

for both examples, of course there's no need have .select after each other; can 1 .select if substitute 1 lambda arrow => other.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -