public static bool HasDefaultConstructor(Type t, bool nonPublic) { ValidationUtils.ArgumentNotNull(t, "t"); if (t.IsValueType()) { return(true); } return(ReflectionUtils.GetDefaultConstructor(t, nonPublic) != null); }
public override Func <T> CreateDefaultConstructor <T>(Type type) { ValidationUtils.ArgumentNotNull(type, "type"); if (type.IsValueType) { return(() => (T)((object)ReflectionUtils.CreateInstance(type, new object[0]))); } ConstructorInfo constructorInfo = ReflectionUtils.GetDefaultConstructor(type, true); return(() => (T)((object)constructorInfo.Invoke(null))); }
public override Func <T> CreateDefaultConstructor <T>(Type type) { ValidationUtils.ArgumentNotNull(type, "type"); if (type.IsValueType()) { return(() => (T)Activator.CreateInstance(type)); } ConstructorInfo defaultConstructor = ReflectionUtils.GetDefaultConstructor(type, true); return(() => (T)defaultConstructor.Invoke(null)); }
public override Func <T> CreateDefaultConstructor <T>(Type type) { ValidationUtils.ArgumentNotNull((object)type, nameof(type)); if (type.IsValueType()) { return((Func <T>)(() => (T)Activator.CreateInstance(type))); } ConstructorInfo constructorInfo = ReflectionUtils.GetDefaultConstructor(type, true); return((Func <T>)(() => (T)constructorInfo.Invoke((object[])null))); }
public override Func <T> CreateDefaultConstructor <T>(Type type) { if (type.IsValueType) { return(() => (T)ReflectionUtils.CreateInstance(type)); } ConstructorInfo constructorInfo = ReflectionUtils.GetDefaultConstructor(type, true); return(() => (T)constructorInfo.Invoke(null)); }
public override Func <T> CreateDefaultConstructor <T>(Type type) { ConstructorInfo constructorInfo; ValidationUtils.ArgumentNotNull(type, "type"); if (!type.IsValueType()) { constructorInfo = ReflectionUtils.GetDefaultConstructor(type, true); } return(() => ((T)constructorInfo.Invoke(null))); }
public static bool HasDefaultConstructor(Type t, bool nonPublic) { ValidationUtils.ArgumentNotNull((object)t, "t"); if (TypeExtensions.IsValueType(t)) { return(true); } else { return(ReflectionUtils.GetDefaultConstructor(t, nonPublic) != null); } }
public override Newtonsoft.Json.Serialization.Func <T> CreateDefaultConstructor <T>(Type type) { ValidationUtils.ArgumentNotNull(type, nameof(type)); if (type.IsValueType()) { return(() => (T)Activator.CreateInstance(type)); } ConstructorInfo constructorInfo = ReflectionUtils.GetDefaultConstructor(type, true); return(() => (T)constructorInfo.Invoke(null)); }
// Token: 0x06000E22 RID: 3618 RVA: 0x00051A74 File Offset: 0x0004FC74 public static ConstructorInfo GetDefaultConstructor(Type t) { return(ReflectionUtils.GetDefaultConstructor(t, false)); }
public static bool HasDefaultConstructor(Type t, bool nonPublic) { ValidationUtils.ArgumentNotNull((object)t, nameof(t)); return(t.IsValueType() || ReflectionUtils.GetDefaultConstructor(t, nonPublic) != null); }