如何解析十六进制值成UINT? [英] How to parse hex values into a uint?

查看:155
本文介绍了如何解析十六进制值成UINT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

uint color; 
bool parsedhex = uint.TryParse(TextBox1.Text, out color); 
//where Text is of the form 0xFF0000
if(parsedhex)
   //...

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

doesn't work. What am i doing wrong?

推荐答案

尝试

Convert.ToUInt32(hex, 16)  //Using ToUInt32 not ToUInt64, as per OP comment

这篇关于如何解析十六进制值成UINT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆