Monday, June 18, 2018

int.parse vs Convert.int32

Both int.Parse and Convert.ToInt32 are used to convert string into the integer but Only difference between them is to Convert.ToInt32 handle null and returns '0' as output and int.parse is not going to handle NULL and will give a Argument Null Exception.

Similarly, Convert.ToString()  handles Null value and return string.empty (""), where as
.ToString() will throw exception in case of Nulls.

No comments:

Post a Comment