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

前端 未结 13 2175
-上瘾入骨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:12

    No difference as such.
    Convert.ToInt32() calls int.Parse() internally

    Except for one thing Convert.ToInt32() returns 0 when argument is null

    Otherwise both work the same way

    0 讨论(0)
提交回复
热议问题