Int32 result = -1;
if (Int32.TryParse("210s"out result))
{
    
// Parsing succeeds, now you can safely use the value.
}
else
{
    
// Parsing fails, this route is faster.
}

Int32 result = -1;
try
{
    result 
= Int32.Parse("210s")
}
catch(Exception)
{
    
// Parsing fails, this route is slower.
}

相关文章:

  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2021-08-21
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-16
  • 2021-07-20
  • 2022-12-23
  • 2021-06-01
相关资源
相似解决方案