public static string ToBinary8(int value)
{
// Power by Zealic
char[] chars = new char[8];
value = value & 0xFF;
for (int i = 7; i >= 0; i--)
{
chars[i] = (value % 2 == 1) ? '1' : '0';
value /= 2;
}
return new string(chars);
}
直接调用上面的函数即可
温馨提示:答案为网友推荐,仅供参考