string转换为int值?

use*_*351 1 c# asp.net

我想将字符串值转换为int值,所以我试过这些东西:

// 1.
string a = "4163";
int b = int.Parse(a);

// 2.
int intValue;
int.TryParse(a, out intValue);

// 3.
int b = Convert.ToInt32(a);
Run Code Online (Sandbox Code Playgroud)

但总是我的输出看起来像这样:

调试器中的输出值错误

它总是写0x00001043,但我需要4163作为输出.我的代码有什么问题?

Sac*_*hin 8

您的代码应该按预期工作.可能是您需要更改显示设置.所以做这样的事情

右键单击Watch Window并取消选择十六进制显示值.