2 // System.Reflection.MonoGenericClass
4 // Sean MacIsaac (macisaac@ximian.com)
5 // Paolo Molaro (lupus@ximian.com)
6 // Patrik Torstensson (patrik.torstensson@labs2.com)
8 // (C) 2001 Ximian, Inc.
12 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 using System.Reflection;
35 using System.Reflection.Emit;
36 using System.Collections;
37 using System.Runtime.CompilerServices;
38 using System.Globalization;
39 using System.Runtime.Serialization;
42 namespace System.Reflection
45 * MonoGenericClass represents an instantiation of a generic TypeBuilder. MS
46 * calls this class TypeBuilderInstantiation (a much better name). MS returns
47 * NotImplementedException for many of the methods but we can't do that as gmcs
50 internal class MonoGenericClass : Type
52 #region Keep in sync with object-internals.h
53 #pragma warning disable 649
54 internal Type generic_type;
55 Type[] type_arguments;
57 #pragma warning restore 649
60 Hashtable fields, ctors, methods;
62 int is_compiler_context;
64 internal MonoGenericClass ()
66 // this should not be used
67 throw new InvalidOperationException ();
70 internal MonoGenericClass (Type tb, Type[] args)
72 this.generic_type = tb;
73 this.type_arguments = args;
74 register_with_runtime (this); /*Temporary hack while*/
78 internal override bool IsCompilerContext {
80 if (is_compiler_context == 0) {
81 bool is_cc = generic_type.IsCompilerContext;
82 foreach (Type t in type_arguments)
83 is_cc |= t.IsCompilerContext;
84 is_compiler_context = is_cc ? 1 : -1;
86 return is_compiler_context == 1;
90 [MethodImplAttribute(MethodImplOptions.InternalCall)]
91 extern void initialize (MethodInfo[] methods, ConstructorInfo[] ctors, FieldInfo[] fields, PropertyInfo[] properties, EventInfo[] events);
93 [MethodImplAttribute(MethodImplOptions.InternalCall)]
94 internal static extern void register_with_runtime (Type type);
96 EventInfo[] GetEventsFromGTD (BindingFlags flags) {
97 TypeBuilder tb = generic_type as TypeBuilder;
99 return generic_type.GetEvents (flags);
101 return tb.GetEvents_internal (flags);
104 ConstructorInfo[] GetConstructorsFromGTD (BindingFlags flags)
106 TypeBuilder tb = generic_type as TypeBuilder;
108 return generic_type.GetConstructors (flags);
110 return tb.GetConstructorsInternal (flags);
114 MethodInfo[] GetMethodsFromGTD (BindingFlags bf)
116 TypeBuilder tb = generic_type as TypeBuilder;
118 return generic_type.GetMethods (bf);
120 MethodInfo[] res = new MethodInfo [tb.num_methods];
121 if (tb.num_methods > 0)
122 Array.Copy (tb.methods, res, tb.num_methods);
128 FieldInfo[] GetFieldsFromGTD (BindingFlags bf)
130 TypeBuilder tb = generic_type as TypeBuilder;
132 return generic_type.GetFields (bf);
134 FieldInfo[] res = new FieldInfo [tb.num_fields];
135 if (tb.num_fields > 0)
136 Array.Copy (tb.fields, res, tb.num_fields);
141 /*@hint might not be honored so it required aditional filtering
142 TODO move filtering into here for the TypeBuilder case and remove the hint ugliness
144 MethodInfo[] GetMethodsFromGTDWithHint (BindingFlags hint)
146 TypeBuilder tb = generic_type as TypeBuilder;
148 return generic_type.GetMethods (hint);
150 if (tb.num_methods == 0)
151 return new MethodInfo [0];
152 MethodInfo[] res = new MethodInfo [tb.num_methods];
153 Array.Copy (tb.methods, 0, res, 0, tb.num_methods);
157 /*@hint might not be honored so it required aditional filtering
158 TODO move filtering into here for the TypeBuilder case and remove the hint ugliness
160 ConstructorInfo[] GetConstructorsFromGTDWithHint (BindingFlags hint)
162 TypeBuilder tb = generic_type as TypeBuilder;
164 return generic_type.GetConstructors (hint);
166 if (tb.ctors == null)
167 return new ConstructorInfo [0];
168 ConstructorInfo[] res = new ConstructorInfo [tb.ctors.Length];
169 tb.ctors.CopyTo (res, 0);
173 static Type PeelType (Type t) {
174 if (t.HasElementType)
175 return PeelType (t.GetElementType ());
176 if (t.IsGenericType && !t.IsGenericParameter)
177 return t.GetGenericTypeDefinition ();
181 static PropertyInfo[] GetPropertiesInternal (Type type, BindingFlags bf)
183 TypeBuilder tb = type as TypeBuilder;
185 return tb.properties;
186 return type.GetProperties (bf);
189 Type[] GetInterfacesFromGTD ()
191 TypeBuilder tb = generic_type as TypeBuilder;
193 return tb.interfaces;
194 return generic_type.GetInterfaces ();
197 internal bool IsCreated {
199 TypeBuilder tb = generic_type as TypeBuilder;
200 return tb != null ? tb.is_created : true;
204 private const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic |
205 BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
212 MonoGenericClass parent = GetParentType () as MonoGenericClass;
214 parent.initialize ();
215 EventInfo[] events = GetEventsFromGTD (flags);
216 event_count = events.Length;
218 initialize (generic_type.GetMethods (flags),
219 GetConstructorsFromGTD (flags),
220 generic_type.GetFields (flags),
221 generic_type.GetProperties (flags),
227 Type GetParentType ()
229 return InflateType (generic_type.BaseType);
232 internal Type InflateType (Type type)
234 return InflateType (type, type_arguments, null);
237 internal Type InflateType (Type type, Type[] method_args)
239 return InflateType (type, type_arguments, method_args);
242 internal static Type InflateType (Type type, Type[] type_args, Type[] method_args)
246 if (!type.IsGenericParameter && !type.ContainsGenericParameters)
248 if (type.IsGenericParameter) {
249 if (type.DeclaringMethod == null)
250 return type_args == null ? type : type_args [type.GenericParameterPosition];
251 return method_args == null ? type : method_args [type.GenericParameterPosition];
254 return InflateType (type.GetElementType (), type_args, method_args).MakePointerType ();
256 return InflateType (type.GetElementType (), type_args, method_args).MakeByRefType ();
258 if (type.GetArrayRank () > 1)
259 return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType (type.GetArrayRank ());
260 #if BOOTSTRAP_NET_2_0
261 if (type.ToString ().EndsWith ("[*]"))
263 if (type.ToString ().EndsWith ("[*]", StringComparison.Ordinal)) /*FIXME, the reflection API doesn't offer a way around this*/
265 return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType (1);
266 return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType ();
269 Type[] args = type.GetGenericArguments ();
270 for (int i = 0; i < args.Length; ++i)
271 args [i] = InflateType (args [i], type_args, method_args);
273 Type gtd = type.IsGenericTypeDefinition ? type : type.GetGenericTypeDefinition ();
274 return gtd.MakeGenericType (args);
277 public override Type BaseType {
279 Type parent = GetParentType ();
280 return parent != null ? parent : generic_type.BaseType;
284 Type[] GetInterfacesInternal ()
286 Type[] ifaces = GetInterfacesFromGTD ();
289 Type[] res = new Type [ifaces.Length];
290 for (int i = 0; i < res.Length; ++i)
291 res [i] = InflateType (ifaces [i]);
295 public override Type[] GetInterfaces ()
297 if (!IsCompilerContext) {
298 Console.WriteLine ("--FAIL {0}", this);
299 Console.WriteLine ("\tgt {0}/{1}/{2}", generic_type, generic_type.IsCompilerContext, generic_type.GetType ());
301 foreach (Type t in type_arguments)
302 Console.WriteLine ("\targ {0}/{1}/{2}", t, t.IsCompilerContext, t.GetType ());
304 throw new NotSupportedException ();
306 return GetInterfacesInternal ();
309 protected override bool IsValueTypeImpl ()
311 return generic_type.IsValueType;
314 internal override MethodInfo GetMethod (MethodInfo fromNoninstanciated)
319 methods = new Hashtable ();
320 if (!methods.ContainsKey (fromNoninstanciated))
321 methods [fromNoninstanciated] = new MethodOnTypeBuilderInst (this, fromNoninstanciated);
322 return (MethodInfo)methods [fromNoninstanciated];
325 internal override ConstructorInfo GetConstructor (ConstructorInfo fromNoninstanciated)
330 ctors = new Hashtable ();
331 if (!ctors.ContainsKey (fromNoninstanciated))
332 ctors [fromNoninstanciated] = new ConstructorOnTypeBuilderInst (this, fromNoninstanciated);
333 return (ConstructorInfo)ctors [fromNoninstanciated];
336 internal override FieldInfo GetField (FieldInfo fromNoninstanciated)
340 fields = new Hashtable ();
341 if (!fields.ContainsKey (fromNoninstanciated))
342 fields [fromNoninstanciated] = new FieldOnTypeBuilderInst (this, fromNoninstanciated);
343 return (FieldInfo)fields [fromNoninstanciated];
346 public override MethodInfo[] GetMethods (BindingFlags bf)
348 if (!IsCompilerContext)
349 throw new NotSupportedException ();
351 ArrayList l = new ArrayList ();
354 // Walk up our class hierarchy and retrieve methods from our
357 if (!(generic_type is TypeBuilder)) {
358 foreach (var method in generic_type.GetMethods (bf)) {
360 if (m.DeclaringType.IsGenericTypeDefinition)
361 m = TypeBuilder.GetMethod (this, m);
365 Type current_type = this;
367 MonoGenericClass gi = current_type as MonoGenericClass;
369 l.AddRange (gi.GetMethodsInternal (bf, this));
370 else if (current_type is TypeBuilder)
371 l.AddRange (current_type.GetMethods (bf));
373 // If we encounter a `MonoType', its
374 // GetMethodsByName() will return all the methods
375 // from its parent type(s), so we can stop here.
376 MonoType mt = (MonoType) current_type;
377 l.AddRange (mt.GetMethodsByName (null, bf, false, this));
381 if ((bf & BindingFlags.DeclaredOnly) != 0)
383 current_type = current_type.BaseType;
384 } while (current_type != null);
387 MethodInfo[] result = new MethodInfo [l.Count];
392 MethodInfo[] GetMethodsInternal (BindingFlags bf, MonoGenericClass reftype)
395 bf |= BindingFlags.DeclaredOnly; /*To avoid duplicates*/
397 MethodInfo[] methods = GetMethodsFromGTDWithHint (bf);
398 if (methods.Length == 0)
399 return new MethodInfo [0];
401 ArrayList l = new ArrayList ();
403 MethodAttributes mattrs;
407 for (int i = 0; i < methods.Length; ++i) {
408 MethodInfo c = methods [i];
411 mattrs = c.Attributes;
412 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
413 if ((bf & BindingFlags.Public) != 0)
416 if ((bf & BindingFlags.NonPublic) != 0)
422 if ((mattrs & MethodAttributes.Static) != 0) {
423 if ((bf & BindingFlags.Static) != 0)
426 if ((bf & BindingFlags.Instance) != 0)
431 if (c.DeclaringType.IsGenericTypeDefinition)
432 c = TypeBuilder.GetMethod (this, c);
436 MethodInfo[] result = new MethodInfo [l.Count];
441 public override ConstructorInfo[] GetConstructors (BindingFlags bf)
443 if (!IsCompilerContext)
444 throw new NotSupportedException ();
446 ArrayList l = new ArrayList ();
448 Type current_type = this;
450 MonoGenericClass gi = current_type as MonoGenericClass;
452 l.AddRange (gi.GetConstructorsInternal (bf, this));
453 else if (current_type is TypeBuilder)
454 l.AddRange (current_type.GetConstructors (bf));
456 MonoType mt = (MonoType) current_type;
457 l.AddRange (mt.GetConstructors_internal (bf, this));
461 if ((bf & BindingFlags.DeclaredOnly) != 0)
463 current_type = current_type.BaseType;
464 } while (current_type != null);
466 ConstructorInfo[] result = new ConstructorInfo [l.Count];
471 ConstructorInfo[] GetConstructorsInternal (BindingFlags bf, MonoGenericClass reftype)
473 ConstructorInfo[] ctors = GetConstructorsFromGTDWithHint (bf);
474 if (ctors == null || ctors.Length == 0)
475 return new ConstructorInfo [0];
477 ArrayList l = new ArrayList ();
479 MethodAttributes mattrs;
483 for (int i = 0; i < ctors.Length; i++) {
484 ConstructorInfo c = ctors [i];
487 mattrs = c.Attributes;
488 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
489 if ((bf & BindingFlags.Public) != 0)
492 if ((bf & BindingFlags.NonPublic) != 0)
498 if ((mattrs & MethodAttributes.Static) != 0) {
499 if ((bf & BindingFlags.Static) != 0)
502 if ((bf & BindingFlags.Instance) != 0)
507 l.Add (TypeBuilder.GetConstructor (this, c));
510 ConstructorInfo[] result = new ConstructorInfo [l.Count];
515 public override FieldInfo[] GetFields (BindingFlags bf)
517 if (!IsCompilerContext)
518 throw new NotSupportedException ();
520 ArrayList l = new ArrayList ();
522 Type current_type = this;
524 MonoGenericClass gi = current_type as MonoGenericClass;
526 l.AddRange (gi.GetFieldsInternal (bf, this));
527 else if (current_type is TypeBuilder)
528 l.AddRange (current_type.GetFields (bf));
530 MonoType mt = (MonoType) current_type;
531 l.AddRange (mt.GetFields_internal (bf, this));
535 if ((bf & BindingFlags.DeclaredOnly) != 0)
537 current_type = current_type.BaseType;
538 } while (current_type != null);
540 FieldInfo[] result = new FieldInfo [l.Count];
545 FieldInfo[] GetFieldsInternal (BindingFlags bf, MonoGenericClass reftype)
547 FieldInfo[] fields = GetFieldsFromGTD (bf);
548 if (fields.Length == 0)
549 return new FieldInfo [0];
551 ArrayList l = new ArrayList ();
553 FieldAttributes fattrs;
557 for (int i = 0; i < fields.Length; i++) {
558 FieldInfo c = fields [i];
561 fattrs = c.Attributes;
562 if ((fattrs & FieldAttributes.FieldAccessMask) == FieldAttributes.Public) {
563 if ((bf & BindingFlags.Public) != 0)
566 if ((bf & BindingFlags.NonPublic) != 0)
572 if ((fattrs & FieldAttributes.Static) != 0) {
573 if ((bf & BindingFlags.Static) != 0)
576 if ((bf & BindingFlags.Instance) != 0)
581 l.Add (TypeBuilder.GetField (this, c));
584 FieldInfo[] result = new FieldInfo [l.Count];
589 public override PropertyInfo[] GetProperties (BindingFlags bf)
591 if (!IsCompilerContext)
592 throw new NotSupportedException ();
594 ArrayList l = new ArrayList ();
596 Type current_type = this;
598 MonoGenericClass gi = current_type as MonoGenericClass;
600 l.AddRange (gi.GetPropertiesInternal (bf, this));
601 else if (current_type is TypeBuilder)
602 l.AddRange (current_type.GetProperties (bf));
604 MonoType mt = (MonoType) current_type;
605 l.AddRange (mt.GetPropertiesByName (null, bf, false, this));
609 if ((bf & BindingFlags.DeclaredOnly) != 0)
611 current_type = current_type.BaseType;
612 } while (current_type != null);
614 PropertyInfo[] result = new PropertyInfo [l.Count];
619 PropertyInfo[] GetPropertiesInternal (BindingFlags bf, MonoGenericClass reftype)
621 PropertyInfo[] props = GetPropertiesInternal (generic_type, bf);
622 if (props == null || props.Length == 0)
623 return new PropertyInfo [0];
625 ArrayList l = new ArrayList ();
627 MethodAttributes mattrs;
632 foreach (PropertyInfo pinfo in props) {
634 accessor = pinfo.GetGetMethod (true);
635 if (accessor == null)
636 accessor = pinfo.GetSetMethod (true);
637 if (accessor == null)
639 mattrs = accessor.Attributes;
640 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
641 if ((bf & BindingFlags.Public) != 0)
644 if ((bf & BindingFlags.NonPublic) != 0)
650 if ((mattrs & MethodAttributes.Static) != 0) {
651 if ((bf & BindingFlags.Static) != 0)
654 if ((bf & BindingFlags.Instance) != 0)
659 l.Add (new PropertyOnTypeBuilderInst (reftype, pinfo));
661 PropertyInfo[] result = new PropertyInfo [l.Count];
666 public override EventInfo[] GetEvents (BindingFlags bf)
668 if (!IsCompilerContext)
669 throw new NotSupportedException ();
671 ArrayList l = new ArrayList ();
673 Type current_type = this;
675 MonoGenericClass gi = current_type as MonoGenericClass;
677 l.AddRange (gi.GetEventsInternal (bf, this));
678 else if (current_type is TypeBuilder)
679 l.AddRange (current_type.GetEvents (bf));
681 MonoType mt = (MonoType) current_type;
682 l.AddRange (mt.GetEvents (bf));
686 if ((bf & BindingFlags.DeclaredOnly) != 0)
688 current_type = current_type.BaseType;
689 } while (current_type != null);
691 EventInfo[] result = new EventInfo [l.Count];
696 EventInfo[] GetEventsInternal (BindingFlags bf, MonoGenericClass reftype) {
697 TypeBuilder tb = generic_type as TypeBuilder;
699 EventInfo[] res = generic_type.GetEvents (bf);
700 for (int i = 0; i < res.Length; ++i)
701 res [i] = new EventOnTypeBuilderInst (this, res [i]);
704 EventBuilder[] events = tb.events;
706 if (events == null || events.Length == 0)
707 return new EventInfo [0];
711 ArrayList l = new ArrayList ();
713 MethodAttributes mattrs;
716 for (int i = 0; i < event_count; ++i) {
717 EventBuilder ev = events [i];
720 accessor = ev.add_method;
721 if (accessor == null)
722 accessor = ev.remove_method;
723 if (accessor == null)
725 mattrs = accessor.Attributes;
726 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
727 if ((bf & BindingFlags.Public) != 0)
730 if ((bf & BindingFlags.NonPublic) != 0)
736 if ((mattrs & MethodAttributes.Static) != 0) {
737 if ((bf & BindingFlags.Static) != 0)
740 if ((bf & BindingFlags.Instance) != 0)
745 l.Add (new EventOnTypeBuilderInst (this, ev));
747 EventInfo[] result = new EventInfo [l.Count];
752 public override Type[] GetNestedTypes (BindingFlags bf)
754 return generic_type.GetNestedTypes (bf);
757 public override bool IsAssignableFrom (Type c)
762 Type[] interfaces = GetInterfacesInternal ();
765 if (interfaces == null)
767 foreach (Type t in interfaces)
768 if (c.IsAssignableFrom (t))
773 Type parent = GetParentType ();
775 return c == typeof (object);
777 return c.IsAssignableFrom (parent);
780 public override Type UnderlyingSystemType {
784 public override Assembly Assembly {
785 get { return generic_type.Assembly; }
788 public override Module Module {
789 get { return generic_type.Module; }
792 public override string Name {
793 get { return generic_type.Name; }
796 public override string Namespace {
797 get { return generic_type.Namespace; }
800 public override string FullName {
801 get { return format_name (true, false); }
804 public override string AssemblyQualifiedName {
805 get { return format_name (true, true); }
808 public override Guid GUID {
809 get { throw new NotSupportedException (); }
812 string format_name (bool full_name, bool assembly_qualified)
814 StringBuilder sb = new StringBuilder (generic_type.FullName);
815 bool compiler_ctx = IsCompilerContext;
818 for (int i = 0; i < type_arguments.Length; ++i) {
824 string assemblyName = type_arguments [i].Assembly.FullName;
825 name = type_arguments [i].FullName;
826 if (name != null && assemblyName != null)
827 name = name + ", " + assemblyName;
829 name = type_arguments [i].ToString ();
832 if (compiler_ctx && type_arguments [i].IsGenericParameter)
833 name = type_arguments [i].Name;
844 if (assembly_qualified) {
846 sb.Append (generic_type.Assembly.FullName);
848 return sb.ToString ();
851 public override string ToString ()
853 return format_name (false, false);
856 public override Type GetGenericTypeDefinition ()
861 public override Type[] GetGenericArguments ()
863 Type[] ret = new Type [type_arguments.Length];
864 type_arguments.CopyTo (ret, 0);
868 public override bool ContainsGenericParameters {
870 /*FIXME remove this once compound types are not instantiated using MGC*/
872 return GetElementType ().ContainsGenericParameters;
874 foreach (Type t in type_arguments) {
875 if (t.ContainsGenericParameters)
882 public override bool IsGenericTypeDefinition {
883 get { return false; }
886 public override bool IsGenericType {
887 get { return !HasElementType; }
890 public override Type DeclaringType {
891 get { return InflateType (generic_type.DeclaringType); }
894 public override RuntimeTypeHandle TypeHandle {
896 if (!IsCompilerContext)
897 throw new NotSupportedException ();
902 public override Type MakeArrayType ()
904 return new ArrayType (this, 0);
907 public override Type MakeArrayType (int rank)
910 throw new IndexOutOfRangeException ();
911 return new ArrayType (this, rank);
914 public override Type MakeByRefType ()
916 return new ByRefType (this);
919 public override Type MakePointerType ()
921 return new PointerType (this);
924 public override Type GetElementType ()
926 throw new NotSupportedException ();
929 protected override bool HasElementTypeImpl ()
934 protected override bool IsCOMObjectImpl ()
939 protected override bool IsPrimitiveImpl ()
944 protected override bool IsArrayImpl ()
949 protected override bool IsByRefImpl ()
954 protected override bool IsPointerImpl ()
959 protected override TypeAttributes GetAttributeFlagsImpl ()
961 return generic_type.Attributes;
965 public override Type GetInterface (string name, bool ignoreCase)
967 throw new NotSupportedException ();
970 public override EventInfo GetEvent (string name, BindingFlags bindingAttr)
972 if (!IsCompilerContext)
973 throw new NotSupportedException ();
974 foreach (var evt in GetEvents (bindingAttr)) {
975 if (evt.Name == name)
981 public override FieldInfo GetField( string name, BindingFlags bindingAttr)
983 throw new NotSupportedException ();
986 public override MemberInfo[] GetMembers (BindingFlags bindingAttr)
988 throw new NotSupportedException ();
991 public override Type GetNestedType (string name, BindingFlags bindingAttr)
993 throw new NotSupportedException ();
996 public override object InvokeMember (string name, BindingFlags invokeAttr,
997 Binder binder, object target, object[] args,
998 ParameterModifier[] modifiers,
999 CultureInfo culture, string[] namedParameters)
1001 throw new NotSupportedException ();
1004 protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder,
1005 CallingConventions callConvention, Type[] types,
1006 ParameterModifier[] modifiers)
1008 throw new NotSupportedException ();
1011 protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder,
1012 Type returnType, Type[] types, ParameterModifier[] modifiers)
1014 throw new NotSupportedException ();
1017 protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
1019 CallingConventions callConvention,
1021 ParameterModifier[] modifiers)
1023 if (!IsCompilerContext)
1024 throw new NotSupportedException ();
1025 return MonoType.GetConstructorImpl (GetConstructors (bindingAttr), bindingAttr, binder, callConvention, types, modifiers);
1029 public override bool IsDefined (Type attributeType, bool inherit)
1031 if (!IsCompilerContext)
1032 throw new NotSupportedException ();
1033 return generic_type.IsDefined (attributeType, inherit);
1036 public override object [] GetCustomAttributes (bool inherit)
1038 if (!IsCompilerContext)
1039 throw new NotSupportedException ();
1040 return generic_type.GetCustomAttributes (inherit);
1043 public override object [] GetCustomAttributes (Type attributeType, bool inherit)
1045 if (!IsCompilerContext)
1046 throw new NotSupportedException ();
1047 return generic_type.GetCustomAttributes (attributeType, inherit);