Closed textGamex closed 7 months ago
在原来的 toInt 实现中:
toInt
public static int toInt(string str, int defaultValue) { var result = defaultValue; int.TryParse(str, out result); return result; }
无论 defaultValue 为什么值, 当解析失败时, result 的值都会被覆盖为 0, 虽然在代码中参数 defaultValue 全是 0, 但这总归是一个 bug
defaultValue
result
在原来的
toInt
实现中:无论
defaultValue
为什么值, 当解析失败时,result
的值都会被覆盖为 0, 虽然在代码中参数defaultValue
全是 0, 但这总归是一个 bug