2017-10-16 151 views
0

在嘗試此字符串0x0000F85D
轉換爲整數值 我嘗試了所有的流行的方法 但沒有工作 任何想法,請 var hello= "0x0000F85D"; var i = ??? ;轉換0x0000F85D字符串爲int C#

+5

可能重複的[C#將整數轉換爲十六進制並返回](https://stackoverflow.com/questions/1139957/c-sharp-convert-integer-to-hex-and-back-again) – Equalsk

+0

該int.Parse(hexValue,System.Globalization.NumberStyles.HexNumber)方法只能在沒有前導0x的情況下工作。該文檔(https://msdn.microsoft.com/en-us/library/system.globalization.numberstyles(v=vs.110).aspx)表示,使用此樣式解析的字符串不能以「0x」作爲前綴,或「&h」 –

回答