我正在尝试制作一个字典来从二进制转换为十六进制,这就是我所做的:
private Dictionary<string, char> binaryCharacterTohex = new Dictionary<string, char>
{
{'0000', "0"},
{'0001', "1"},
{'0010', "2"},
{'0011', "3"},
{'0100', "4"},
{'0101', "5"},
{'0110', "6"},
{'0111', "7"},
{'1000', "8"},
{'1001', "9"},
{'1010', "a"},
{'1011', "b"},
{'1100', "c"},
{'1101', "d"},
{'1110', "e"},
{'1111', "f"}
};
但它总是在我放在那里的每个二进制字符串值('XXXX')上给我“错误的编译常量值”,任何人都可以帮助我吗?