castare string in int C# code example
Example 1: parsing string to int c#
string userInput = Console.ReadLine();
int convert;
Int32.TryParse(userInput, out convert); // Converting String to int
Example 2: how to convert string to int in c#
string a = ("2");
int b = Convert.ToInt16(a)