Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的解决方案似乎很愚蠢,但它可以防止错误。有一个更好的方法吗?
try { myNumber = Convert.ToInt32(InputRow.Substring(288, 9)); } catch (FormatException e) { }
int.TryParse 可能是一个不错的选择
int val = 0; if(int.TryParse(InputRow.Substring(288, 9), out val)) // insert val into db