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.
string text = "123";
int number = Convert.ToInt32(text);
The catch with…Read More Convert.ToInt32 versus TryParse