转换C#字节BitArray [英] Converting C# byte to BitArray

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

问题描述

是否有可用的转换字节 BitArray

一个方法是检查的每比特字节的值,然后执行按位操作。我不知道是否有什么办法这是比较简单的,然后这一点。

One way would be to inspect every bit of the byte value and then perform bitwise operation. I was wondering if there is any way which is more straightforward then this.

推荐答案

是,使用适当的 BitArray()构造描述这里

var bits = new BitArray(arrayOfBytes);

您可以用新BitArray(新的byte [] {yourBite}叫它)以创建一个字节数组。

You can call it with new BitArray(new byte[] { yourBite }) to create an array of one byte.

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

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