static class ClassExtension { public static string NullableToString(this object o) { try { return o.ToString(); } catch { return ""; } } public static bool NullableToBool(this object o) { try { if (o.ToString() == "True") return true; else return false; } catch { return false; } } public static int NullableToInt(this object o) { try { return int.Parse(o.ToString()); } catch { return 0; } } }