C# 16进制转10进制
时间: 2023-09-11 07:13:27 浏览: 134
在C#中,可以使用Convert类的ToInt32方法将16进制转换为10进制。该方法接受两个参数,第一个参数是要转换的16进制字符串,第二个参数是指定输入字符串的基数。对于16进制转换为10进制,基数为16。下面是一个示例代码:
```
string hexValue = "A1";
int decimalValue = Convert.ToInt32(hexValue, 16);
```
在这个示例中,将16进制字符串"A1"转换为10进制,得到的结果是161。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [C#16进制转换10进制](https://download.csdn.net/download/5658598/5442259)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [c# 16进制转10进制](https://blog.csdn.net/Qin066/article/details/89227762)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文