public static Int32 UnboxInt32(object value) { if (value is Int32) return (Int32)value; if (value is IConvertible) return CheckNumericPromotion(value).ToInt32(null); return (Int32)value; }