How to convert string to int in C#

1. You could call the ToInt32 method to convert an input string to an int:

C# in Depth, 3rd EditionManaged Windows VPS Hosting

int numberVar = Convert.ToInt32(“37”);

2.You could also convert a string to an int through the Parse method of the System.Int32 struct:

int numberVar = Int32.Parse(“-37”);