c# 整型数据与字符串 的之间互换(原创)

整型数据转换为字符串

方法一: 用到 convet 类里的tostring 方法 

 int f = b + d;
 textBox3.Text = Convert.ToString (f);
 

方法二: 用到了Int 类的 tostring 方法

 int f = b + d;
 textBox3.Text = f.ToString ();
 

字符串转换为整型数据 

方法一:int a = Convert.ToInt32("123"); 用到了Convert 类

方法二:     int b = int.Parse("456");   用到了Int 类 

总结:

转换之间,Convert 类有很多方法可以调用,推荐!

原文地址:https://www.cnblogs.com/bluewelkin/p/1283677.html