C#数据类型的转换
本人是最近才接触C#的菜鸟,在调串口的时候,接收到的数据都是byte类型数组,想直接转换成别的类型,例如,short,int之类的,有哪位大侠知道,请多多指教~
[解决办法]
[解决办法]
- C# code
byte[] bytes = { 1,0,1,0};int test = BitConverter.ToInt32(bytes, 0);
发布时间: 2012-05-23 13:44:13 作者: rapoo
C#数据类型的转换
本人是最近才接触C#的菜鸟,在调串口的时候,接收到的数据都是byte类型数组,想直接转换成别的类型,例如,short,int之类的,有哪位大侠知道,请多多指教~
[解决办法]
byte[] bytes = { 1,0,1,0};int test = BitConverter.ToInt32(bytes, 0);