int.TryParse 与 int.Parse 的区别

int.TryParse 与 int.Parse 的区别是,int.TryParse不会产生异常,转换成功返回 true,转换失败返回 false。最后一个参数为输出值,如果转换失败,输出值为 0。

用法 

int a=0;
bool Result = int.TryParse("100",a)
原文地址:https://www.cnblogs.com/wupeihong/p/3785717.html