C#:将字节数组转换为浮点数 [英] C#: Convert Byte array into a float

查看:48
本文介绍了C#:将字节数组转换为浮点数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大小为 4 的字节数组

I have a byte array of size 4

byte[] source = new byte[4];

现在我想将此源转换为 4 字节浮点值...

Now I wanted to convert this source into a 4-byte float value...

谁能告诉我怎么做...

Can anyone tell me how to do this...

推荐答案

尝试

float myFloat = System.BitConverter.ToSingle(mybyteArray, startIndex);

这篇关于C#:将字节数组转换为浮点数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆