public static Enum17 smethod_0(Type type_0) { Enum17 enum2; if (dictionary_0.TryGetValue(type_0, out enum2)) { return(enum2); } if (type_0.smethod_7()) { return(smethod_0(Enum.GetUnderlyingType(type_0))); } if (Class194.smethod_10(type_0)) { Type underlyingType = Nullable.GetUnderlyingType(type_0); if (underlyingType.smethod_7()) { return(smethod_0(typeof(Nullable <>).MakeGenericType(new Type[] { Enum.GetUnderlyingType(underlyingType) }))); } } return(Enum17.Object); }
private static bool smethod_1(object object_1) { return((object_1 is T) || ((object_1 == null) && (!typeof(T).smethod_12() || Class194.smethod_10(typeof(T))))); }
public static object smethod_8(object object_0, CultureInfo cultureInfo_0, Type type_0) { if (object_0 == null) { throw new ArgumentNullException("initialValue"); } if (Class194.smethod_10(type_0)) { type_0 = Nullable.GetUnderlyingType(type_0); } Type type = object_0.GetType(); if (type_0 == type) { return(object_0); } if (smethod_3(object_0.GetType()) && smethod_3(type_0)) { if (type_0.smethod_7()) { if (object_0 is string) { return(Enum.Parse(type_0, object_0.ToString(), true)); } if (smethod_14(object_0)) { return(Enum.ToObject(type_0, object_0)); } } return(Convert.ChangeType(object_0, type_0, cultureInfo_0)); } if ((object_0 is DateTime) && (type_0 == typeof(DateTimeOffset))) { return(new DateTimeOffset((DateTime)object_0)); } if ((object_0 is byte[]) && (type_0 == typeof(Guid))) { return(new Guid((byte[])object_0)); } if (object_0 is string) { if (type_0 == typeof(Guid)) { return(new Guid((string)object_0)); } if (type_0 == typeof(Uri)) { return(new Uri((string)object_0, UriKind.RelativeOrAbsolute)); } if (type_0 == typeof(TimeSpan)) { return(smethod_4((string)object_0)); } if (typeof(Type).IsAssignableFrom(type_0)) { return(Type.GetType((string)object_0, true)); } } if (type_0 == typeof(BigInteger)) { return(smethod_6(object_0)); } if (object_0 is BigInteger) { return(smethod_7((BigInteger)object_0, type_0)); } TypeConverter converter = smethod_13(type); if ((converter != null) && converter.CanConvertTo(type_0)) { return(converter.ConvertTo(null, cultureInfo_0, object_0, type_0)); } TypeConverter converter2 = smethod_13(type_0); if ((converter2 != null) && converter2.CanConvertFrom(type)) { return(converter2.ConvertFrom(null, cultureInfo_0, object_0)); } if (object_0 == DBNull.Value) { if (!Class194.smethod_9(type_0)) { throw new Exception("Can not convert null {0} into non-nullable {1}.".smethod_1(CultureInfo.InvariantCulture, type, type_0)); } return(smethod_11(null, type, type_0)); } if (object_0 is INullable) { return(smethod_11(smethod_12((INullable)object_0), type, type_0)); } if ((!type_0.smethod_3() && !type_0.smethod_5()) && !type_0.smethod_10()) { throw new InvalidOperationException("Can not convert from {0} to {1}.".smethod_1(CultureInfo.InvariantCulture, type, type_0)); } throw new ArgumentException("Target type {0} is not a value type or a non-abstract class.".smethod_0(CultureInfo.InvariantCulture, type_0), "targetType"); }