Difference between int.Parse and Convert.ToInt32

added by jalpesh
11/26/2010 12:02:21 AM

0 Kicks, 97 Views

I know this post sound basic to most of people but still lots of people does not know this. So I decided to post a blog post for this. 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. Here is the example for that both are almost same except handling null. string convertToInt = "12"; ...