如何将十六进制值解析为uint?

uint color; 

bool parsedhex = uint.TryParse(TextBox1.Text, out color); 

//where Text is of the form 0xFF0000

if(parsedhex)

   //...

不起作用。我究竟做错了什么?


拉风的咖菲猫
浏览 645回答 3
3回答

慕尼黑的夜晚无繁华

尝试Convert.ToUInt32(hex, 16)  //Using ToUInt32 not ToUInt64, as per OP comment
打开App,查看更多内容
随时随地看视频慕课网APP