.NET

Difference Between Int32.Parse, Convert.ToInt32, and Int32.TryParse – CodeProject

Every C#/VB/.NET developer should read Difference Between Int32.Parse, Convert.ToInt32, and Int32.TryParse – CodeProject.

Then also read TryParse with default values.

It is all about handling values that are not Integers, Overflow values and Nulls. There are subtle differences, in the handling of the methods, and the exceptions they could throw: ArgumentNullException, FormatException and OverflowException.

Finally read all about the NumberStyles enumeration, IFormatProvider interface and CultureInfo (especially the difference between InvariantCulture, CurrentCulture, CurrentUICulture and InstalledUICulture).

Because getting your conversions right matters.

Related Articles

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button