Convert class makes it easier to convert between the all the base types.
One Difference:
string is null
thrown error when you call int.Parse()
return 0 value when you call Convert.ToInt32()
if you want to know the Difference between Int.Parse() and Convert.ToINT32(). please test the following code:
Output is same when you use your code.
One Difference:
string is null
thrown error when you call int.Parse()
return 0 value when you call Convert.ToInt32()
if you want to know the Difference between Int.Parse() and Convert.ToINT32(). please test the following code:
int a, b; string s = null; b = Convert.ToInt32(s); MessageBox.Show(b.ToString()); a = int.Parse(s); MessageBox.Show(a.ToString());