Difference between int.Parse() and Convert.ToInt32 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Difference between int.Parse() and Convert.ToInt32

Can anyone tell me what is the difference between int.Parse() and Convert.ToInt32 ?

17th May 2017, 5:55 PM
Adrian Szlegel
Adrian Szlegel - avatar
3 Answers
+ 5
They work pretty much the same way, except that Convert.ToInt32() does not throw ArgumentNullException when its argument is null – Int.Parse does. Source: http://stackoverflow.com/questions/199470/whats-the-main-difference-between-int-parse-and-convert-toint32
19th May 2017, 5:14 AM
Álvaro
+ 2
thx!
19th May 2017, 6:42 AM
Adrian Szlegel
Adrian Szlegel - avatar
+ 2
Good to know
27th May 2017, 12:11 AM
Keila Nayara Enéas da Silva
Keila Nayara Enéas da Silva - avatar