Converts string to integer
using System; public class ParseInt32 { public static void Main() { Convert("179"); } private static void Convert(string value) { try { int number = Int32.Parse(value); Console.WriteLine("Converted '{0}' to {1}.", value, number); } catch (FormatException) { Console.WriteLine("Unable to convert '{0}'.", value); } } }
1. | Int32.TryParse Method (String, Int32) | ||
2. | Parse string to integer | ||
3. | Read an input from console and convert to integer |