Convert.ToInt32 versus TryParse

There are two way of converting strings to numerical values in .NET. The first one, supported since the first version of the platform, is the use of System.Convert class. It has methods like ToInt32, ToChar, ToDouble, ToDataTime, ToDecimal, etc. Here is an example of converting string “123” to numerical value 123.

The catch with…

CategoriesC#