using System;
using System.Globalization;
publicclass Example
{
publicstaticvoid Main()
{
string string1 = "2";
try {
int number1 = Int32.Parse(string1);
Console.WriteLine(number1);
}
catch (OverflowException) {
Console.WriteLine("'{0}' is out of range of a 32-bit integer.", string1);
}
catch (FormatException) {
Console.WriteLine("The format of '{0}' is invalid.", string1);
}
}
}