static void Main() { var ageText = "25"; if (int.TryParse(ageText,out int age)) { Console.WriteLine("Hi,My age is {0}",age); } else { Console.WriteLine("age {0} is not valid",ageText); } Console.ReadKey(); }
static void Main() { var ageText = "25"; if (int.TryParse(ageText,out int age)) { Console.WriteLine("Hi,My age is {0}",age); } else { Console.WriteLine("age {0} is not valid",ageText); } Console.ReadKey(); }