What's the main difference between int.Parse() and Convert.ToInt32

前端 未结 13 2389
-上瘾入骨i
-上瘾入骨i 2020-11-22 08:47
  • What is the main difference between int.Parse() and Convert.ToInt32()?
  • Which one is to be preferred
13条回答
  •  佛祖请我去吃肉
    2020-11-22 09:09

    Convert.ToInt32 allows null value, it doesn't throw any errors Int.parse does not allow null value, it throws an ArgumentNullException error.

提交回复
热议问题