using System;
using System.Globalization;
class GFG {
public static void Main()
{
try {
CultureInfo cultures = new CultureInfo("en-US");
string[] values = {"234", "+234", "240",
"255", "140", "-1" };
Console.WriteLine("]n Converted bool value"+
" of specified strings: ");
for (int j = 0; j < values.Length; j++) {
get(values[j], cultures);
}
}
catch (FormatException e) {
Console.WriteLine("\n\nvalue consist invalid format");
Console.Write("Exception Thrown: ");
Console.Write("{0}", e.GetType(), e.Message);
}
catch (OverflowException e) {
Console.WriteLine("\n\nvalue represents a number"+
" that is less than MinValue");
Console.Write("Exception Thrown: ");
Console.Write("{0}", e.GetType(), e.Message);
}
}
public static void get(string s, CultureInfo cultures)
{
byte val = Convert.ToByte(s, cultures);
Console.Write(" {0}, ", val);
}
}