如何转换 BitArray
到单个 int
?
最佳答案
private int getIntFromBitArray(BitArray bitArray)
{
if (bitArray.Length > 32)
throw new ArgumentException("Argument length shall be at most 32 bits.");
int[] array = new int[1];
bitArray.CopyTo(array, 0);
return array[0];
}
关于c# - 如何将 BitArray 转换为单个 int?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5283180/