© 2026 Hedgehog Software, LLC
private static T? Convert<T>(string input) { if(typeof(T) == typeof(bool)) { return Convert<int>(input) != 0; } try { TypeConverter converter = TypeDescriptor.GetConverter(typeof(T)); return (T?)converter.ConvertFromString(input); } catch(NotSupportedException) { return default; } }
return Convert<int>(input) != 0;