RuntimeTypeHandle(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } MonoType mt = ((MonoType)info.GetValue("TypeObj", typeof(MonoType))); value = mt.TypeHandle.Value; if (value == IntPtr.Zero) { throw new SerializationException(Locale.GetText("Insufficient state.")); } }
public static object CreateInstance(Type type, bool nonPublic) { CheckType(type); #if NET_2_0 if (type.ContainsGenericParameters) { throw new ArgumentException(type + " is an open generic type", "type"); } #endif CheckAbstractType(type); ConstructorInfo ctor; MonoType monoType = type as MonoType; if (monoType != null) { ctor = monoType.GetDefaultConstructor(); if (!nonPublic && ctor != null && !ctor.IsPublic) { ctor = null; } } else { BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; if (nonPublic) { flags |= BindingFlags.NonPublic; } ctor = type.GetConstructor(flags, null, CallingConventions.Any, Type.EmptyTypes, null); } if (ctor == null) { if (type.IsValueType) { return(CreateInstanceInternal(type)); } throw new MissingMethodException(Locale.GetText("Default constructor not found."), ".ctor() of " + type.FullName); } return(ctor.Invoke(null)); }
public static object CreateInstance(Type type, bool nonPublic) { CheckType(type); if (type.ContainsGenericParameters) { throw new ArgumentException(type + " is an open generic type", "type"); } MonoType monoType = type.UnderlyingSystemType as MonoType; if (monoType == null) { throw new ArgumentException("Type must be a type provided by the runtime"); } CheckAbstractType(monoType); var ctor = monoType.GetDefaultConstructor(); if (!nonPublic && ctor != null && !ctor.IsPublic) { ctor = null; } if (ctor == null) { if (type.IsValueType) { return(CreateInstanceInternal(type)); } throw new MissingMethodException(Locale.GetText("Default constructor not found for type " + type.FullName)); } return(ctor.InternalInvoke(null, null)); }
private static extern void type_from_obj(MonoType type, Object obj);
private static extern void type_from_obj (MonoType type, Object obj);
protected override TypeAttributes GetAttributeFlagsImpl() { return(MonoType.get_attributes(this)); }
internal MonoType(object obj) { MonoType.type_from_obj(this, obj); throw new NotImplementedException(); }
/// <summary> /// Get the type expression that is used to type check this expression. /// </summary> public TypeCheck TypeCheck() { return TC.DoAfter (GetTypeCheck (), (st, exp) => { TypeEnvironment = st.Env; Subs = st.Subs; Type = exp; }); }
private static void type_from_obj(MonoType type, Object obj) { throw new System.NotImplementedException(); }
private static void type_from_obj (MonoType type, Object obj) { throw new System.NotImplementedException(); }