ASP.NET(C#)——int.Parse和Convert.ToInt32

int.Parse和Convert.ToInt32都实现转换成int类型。

Convert.ToInt32调用int.Parse,当对象为null,返回0.

int.Parse 参数为 null 时,抛出异常。  

Convert.ToInt32 参数为 "" 时,抛出异常; 
int.Parse 参数为 "" 时,抛出异常。 
Convert.ToInt32 可以转换的类型较多; 
int.Parse 只能转换数字类型的字符串。 
原文地址:https://www.cnblogs.com/bluewhy/p/5121415.html