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

string str = "199"

int.Parse(str)

  1. This method converts the string to integer. 
  2. If string variable 'str' is null, then it will throw ArgumentNullException. 
  3. If string 'str' has out of integer ranges, then it will throw OverflowException.
  4. If string 'str' is other than integer value, then it will throw FormatException. 


Convert.ToInt32(str)

  1. This method converts the string to integer. 
  2. If string str is null, then it will return 0 rather than throw ArgumentNullException.
  3. If string str represents out of integer ranges, then it will throw OverflowException. 
  4. If string str is other than integer value, then it will throw FormatException.