byte 与 bit 的转换
byte[] bt = new byte[1];
bt[0] = 25;
BitArray ba = new BitArray(bt);
for (int i = 0; i < ba.Count; i++)
{
textBox1.Text += Convert.ToInt16(ba[i]) + " ";
}
结果:1 0 0 1 1 0 0 0
byte[] bt = new byte[1];
bt[0] = 25;
BitArray ba = new BitArray(bt);
for (int i = 0; i < ba.Count; i++)
{
textBox1.Text += Convert.ToInt16(ba[i]) + " ";
}
结果:1 0 0 1 1 0 0 0