我試圖將一個64位數字(例如,字符串"FFFFFFFFF"
)的十六進制表示轉換爲二進制表示("11111..."
)。c#十六進制位轉換
我已經試過
string result = Convert.ToString(Convert.ToUInt64(value, 16), 2);
但這會導致一個令人困惑的編譯器錯誤:
The best overloaded method match for 'System.Convert.ToString(object, System.IFormatProvider)' has some invalid arguments
Argument 2: cannot convert from 'int' to 'System.IFormatProvider'
看看http://stackoverflow.com/questions/74148/how-轉換爲十六進制和十進制數字之間的數字 – CodeZombie 2012-02-28 13:08:05
@ ZombieHunter - 這會如何幫助? OP不會詢問是否轉換爲十進制,而是轉換爲表示_binary_的字符串。 – Oded 2012-02-28 13:09:17
爲什麼要使用'Convert.ToInt64'不起作用? – Oded 2012-02-28 13:10:49