-
Convert.To(s) doesn't throw an exception when argument is null, but Parse() does. Convert.To(s) returns 0 when argument is null.
-
Int.Parse() and Int.TryParse() can only convert strings. Convert.To(s) can take any class that implements IConvertible.Hence, Convert.To(s) is probably a http://blogs.msdn.com/b/ianhu/archive/2005/12/19/505702.aspx than Int.Parse() because it has to ask its argument what it's type is.
So the difference between the Int.Parse and Convert.ToInt32 is the manner in which null is handled. If
you pass a null value to convert.ToInt32 method it will return back 0.
But the same is not true with Int.Parse. If we pass null to Int.Parse
method it will throw an ArgumentNullException exception.
Convert.ToInt16 => consume 1 bytes memory to store integer value
Convert.ToInt32 => consume 2 bytes memory to store integer value
Convert.ToInt64 => consume 4 bytes memory to store integer value. you can use this in place of long because there is not long datatype available in c#.net
Hope this will help you