使用 .net 1.1 执行等效于 int.TryParse(在 .net 2.0 以后的版本中)的最佳方法是什么?
最佳答案
明显地,
class Int32Util
{
public static bool TryParse(string value, out int result)
{
result = 0;
try
{
result = Int32.Parse(value);
return true;
}
catch(FormatException)
{
return false;
}
catch(OverflowException)
{
return false;
}
}
}
关于.net-1.1 - .net 1.1 的 int.TryParse 的最佳替代品是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/709336/