private static bool FromEnumToNumericType <N>(Type enumType, object enumVal, N defaultVal, Type xType, out object result) { var valueUpdated = true; result = defaultVal; if (xType == TypeClass.ByteClass) { result = NumericConv.EnumToByte(enumType, enumVal, NumericConv.ObjectToByte(defaultVal)); } else if (xType == TypeClass.SByteClass) { result = NumericConv.EnumToSByte(enumType, enumVal, NumericConv.ObjectToSByte(defaultVal)); } else if (xType == TypeClass.Int16Class) { result = NumericConv.EnumToInt16(enumType, enumVal, NumericConv.ObjectToInt16(defaultVal)); } else if (xType == TypeClass.UInt16Class) { result = NumericConv.EnumToUInt16(enumType, enumVal, NumericConv.ObjectToUInt16(defaultVal)); } else if (xType == TypeClass.Int32Class) { result = NumericConv.EnumToInt32(enumType, enumVal, NumericConv.ObjectToInt32(defaultVal)); } else if (xType == TypeClass.UInt32Class) { result = NumericConv.EnumToUInt32(enumType, enumVal, NumericConv.ObjectToUInt32(defaultVal)); } else if (xType == TypeClass.Int64Class) { result = NumericConv.EnumToInt64(enumType, enumVal, NumericConv.ObjectToInt64(defaultVal)); } else if (xType == TypeClass.UInt32Class) { result = NumericConv.EnumToUInt64(enumType, enumVal, NumericConv.ObjectToUInt64(defaultVal)); } else { valueUpdated = false; } return(valueUpdated); }