<分区>
Possible Duplicates:
difference between Convert.ToInt32 and (int)
Whats the main difference between int.Parse() and Convert.ToInt32
C#
type.Parse() 方法和 ConvertTo 类中的方法有什么区别吗?
<分区>
Possible Duplicates:
difference between Convert.ToInt32 and (int)
Whats the main difference between int.Parse() and Convert.ToInt32
C#
type.Parse() 方法和 ConvertTo 类中的方法有什么区别吗?
最佳答案
不,Int32.Parse
和 Convert.ToInt32(string)
之间没有实质性区别。后者只是将它的调用转发给 Int32.Parse
但有一个小区别是,如果您将 null
传递给 Convert.ToInt32
,它将返回 0,而 Int32.Parse
将通过一个ArgumentNullException
关于c# - int.Parse() 和 ConvertTo.Int32() 之间的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5491040/