July 17, 2011

Diffference between Convert.ToInt32 and int.Parse

There are some couple of differences between Convert.ToInt32 and int.Parse

1. If we pass null as input string in Convert.ToInt32 it will return 0 while int.Parse will raise an ArgumentNullException.
2. Convert.ToInt32 takes input of any type while int.parse takes string as parameter.
3. Convert.ToInt32 is more like generalized while int.Parse is more like specific.

No comments:

Post a Comment