이 작업을 수행 할 수 있습니다 :
// Chop up the string into individual hex values
string[] hexStrings = hexString.Split(new[] { "\\x" }, StringSplitOptions.RemoveEmptyEntries);
// Convert the individual hex strings into integers
int[] values = hexStrings.Select(s => Convert.ToInt32(s, 16)).ToArray();
// Convert the integers into 8-character binary strings
string[] binaryStrings = values.Select(v => Convert.ToString(v, 2).PadLeft(8, '0')).ToArray();
// Join the strings together
string binaryString = string.Join("", binaryStrings);
편집 - 다음은 BitArray
사용하려는 경우 당신이 무엇을 할 수 있는지의 예 :
// Chop up the string into individual hex values
string[] hexStrings = hexString.Split(new[] { "\\x" }, StringSplitOptions.RemoveEmptyEntries);
// Convert the individual hex strings into bytes
byte[] bytes = hexStrings.Select(s => Convert.ToByte(s, 16)).ToArray();
BitArray bitArray = new BitArray(bytes);
이 도움이됩니까은? http://alperguc.blogspot.ca/2008/11/c-convert-hexadecimal-to-binary-string.html – Brandon
이미 시도했지만 작동하지 않습니다. – Greg
"E8, 00, 00, 00, 00"으로 지정한 값으로 무엇을 기대합니까? 그리고 C#의 가치는 어떻게 표현됩니까? – Brandon