public static uint?GetUInt(object val, bool parse) { if (val == null) { return(null); } try { TypeCode tc = val.GetTypeCode(); switch (tc) { case TypeCode.String: if (!parse) { return(null); } uint n; if (!TryFromServer(Convert.ToString(val), out n, 0)) { return(null); } return(n); case TypeCode.Int32: return(unchecked ((uint)(int)val)); default: if (IsNumeric(tc)) { return(Convert.ToUInt32(val)); } byte[] b = val as byte[]; int ix = 0; if (b?.Length == sizeof(uint)) { return(IOEx.GetUInt32(b, ref ix)); } return(null); } } catch { return(null); } }