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 internal override Type InternalResolve ()
92 Type gtd = generic_type.InternalResolve ();
93 Type[] args = new Type [type_arguments.Length];
94 for (int i = 0; i < type_arguments.Length; ++i)
95 args [i] = type_arguments [i].InternalResolve ();
96 return gtd.MakeGenericType (args);
99 [MethodImplAttribute(MethodImplOptions.InternalCall)]
100 extern void initialize (MethodInfo[] methods, ConstructorInfo[] ctors, FieldInfo[] fields, PropertyInfo[] properties, EventInfo[] events);
102 [MethodImplAttribute(MethodImplOptions.InternalCall)]
103 internal static extern void register_with_runtime (Type type);
105 EventInfo[] GetEventsFromGTD (BindingFlags flags) {
106 TypeBuilder tb = generic_type as TypeBuilder;
108 return generic_type.GetEvents (flags);
110 return tb.GetEvents_internal (flags);
113 ConstructorInfo[] GetConstructorsFromGTD (BindingFlags flags)
115 TypeBuilder tb = generic_type as TypeBuilder;
117 return generic_type.GetConstructors (flags);
119 return tb.GetConstructorsInternal (flags);
123 MethodInfo[] GetMethodsFromGTD (BindingFlags bf)
125 TypeBuilder tb = generic_type as TypeBuilder;
127 return generic_type.GetMethods (bf);
129 MethodInfo[] res = new MethodInfo [tb.num_methods];
130 if (tb.num_methods > 0)
131 Array.Copy (tb.methods, res, tb.num_methods);
137 FieldInfo[] GetFieldsFromGTD (BindingFlags bf)
139 TypeBuilder tb = generic_type as TypeBuilder;
141 return generic_type.GetFields (bf);
143 FieldInfo[] res = new FieldInfo [tb.num_fields];
144 if (tb.num_fields > 0)
145 Array.Copy (tb.fields, res, tb.num_fields);
150 /*@hint might not be honored so it required aditional filtering
151 TODO move filtering into here for the TypeBuilder case and remove the hint ugliness
153 MethodInfo[] GetMethodsFromGTDWithHint (BindingFlags hint)
155 TypeBuilder tb = generic_type as TypeBuilder;
157 return generic_type.GetMethods (hint);
159 if (tb.num_methods == 0)
160 return new MethodInfo [0];
161 MethodInfo[] res = new MethodInfo [tb.num_methods];
162 Array.Copy (tb.methods, 0, res, 0, tb.num_methods);
166 /*@hint might not be honored so it required aditional filtering
167 TODO move filtering into here for the TypeBuilder case and remove the hint ugliness
169 ConstructorInfo[] GetConstructorsFromGTDWithHint (BindingFlags hint)
171 TypeBuilder tb = generic_type as TypeBuilder;
173 return generic_type.GetConstructors (hint);
175 if (tb.ctors == null)
176 return new ConstructorInfo [0];
177 ConstructorInfo[] res = new ConstructorInfo [tb.ctors.Length];
178 tb.ctors.CopyTo (res, 0);
182 static Type PeelType (Type t) {
183 if (t.HasElementType)
184 return PeelType (t.GetElementType ());
185 if (t.IsGenericType && !t.IsGenericParameter)
186 return t.GetGenericTypeDefinition ();
190 static PropertyInfo[] GetPropertiesInternal (Type type, BindingFlags bf)
192 TypeBuilder tb = type as TypeBuilder;
194 return tb.properties;
195 return type.GetProperties (bf);
198 Type[] GetInterfacesFromGTD ()
200 TypeBuilder tb = generic_type as TypeBuilder;
202 return tb.interfaces;
203 return generic_type.GetInterfaces ();
206 internal bool IsCreated {
208 TypeBuilder tb = generic_type as TypeBuilder;
209 return tb != null ? tb.is_created : true;
213 private const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic |
214 BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
221 MonoGenericClass parent = GetParentType () as MonoGenericClass;
223 parent.initialize ();
224 EventInfo[] events = GetEventsFromGTD (flags);
225 event_count = events.Length;
227 initialize (generic_type.GetMethods (flags),
228 GetConstructorsFromGTD (flags),
229 generic_type.GetFields (flags),
230 generic_type.GetProperties (flags),
236 Type GetParentType ()
238 return InflateType (generic_type.BaseType);
241 internal Type InflateType (Type type)
243 return InflateType (type, type_arguments, null);
246 internal Type InflateType (Type type, Type[] method_args)
248 return InflateType (type, type_arguments, method_args);
251 internal static Type InflateType (Type type, Type[] type_args, Type[] method_args)
255 if (!type.IsGenericParameter && !type.ContainsGenericParameters)
257 if (type.IsGenericParameter) {
258 if (type.DeclaringMethod == null)
259 return type_args == null ? type : type_args [type.GenericParameterPosition];
260 return method_args == null ? type : method_args [type.GenericParameterPosition];
263 return InflateType (type.GetElementType (), type_args, method_args).MakePointerType ();
265 return InflateType (type.GetElementType (), type_args, method_args).MakeByRefType ();
267 if (type.GetArrayRank () > 1)
268 return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType (type.GetArrayRank ());
269 #if BOOTSTRAP_NET_2_0
270 if (type.ToString ().EndsWith ("[*]"))
272 if (type.ToString ().EndsWith ("[*]", StringComparison.Ordinal)) /*FIXME, the reflection API doesn't offer a way around this*/
274 return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType (1);
275 return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType ();
278 Type[] args = type.GetGenericArguments ();
279 for (int i = 0; i < args.Length; ++i)
280 args [i] = InflateType (args [i], type_args, method_args);
282 Type gtd = type.IsGenericTypeDefinition ? type : type.GetGenericTypeDefinition ();
283 return gtd.MakeGenericType (args);
286 public override Type BaseType {
288 Type parent = GetParentType ();
289 return parent != null ? parent : generic_type.BaseType;
293 Type[] GetInterfacesInternal ()
295 Type[] ifaces = GetInterfacesFromGTD ();
298 Type[] res = new Type [ifaces.Length];
299 for (int i = 0; i < res.Length; ++i)
300 res [i] = InflateType (ifaces [i]);
304 public override Type[] GetInterfaces ()
306 if (!IsCompilerContext) {
307 Console.WriteLine ("--FAIL {0}", this);
308 Console.WriteLine ("\tgt {0}/{1}/{2}", generic_type, generic_type.IsCompilerContext, generic_type.GetType ());
310 foreach (Type t in type_arguments)
311 Console.WriteLine ("\targ {0}/{1}/{2}", t, t.IsCompilerContext, t.GetType ());
313 throw new NotSupportedException ();
315 return GetInterfacesInternal ();
318 protected override bool IsValueTypeImpl ()
320 return generic_type.IsValueType;
323 internal override MethodInfo GetMethod (MethodInfo fromNoninstanciated)
328 methods = new Hashtable ();
329 if (!methods.ContainsKey (fromNoninstanciated))
330 methods [fromNoninstanciated] = new MethodOnTypeBuilderInst (this, fromNoninstanciated);
331 return (MethodInfo)methods [fromNoninstanciated];
334 internal override ConstructorInfo GetConstructor (ConstructorInfo fromNoninstanciated)
339 ctors = new Hashtable ();
340 if (!ctors.ContainsKey (fromNoninstanciated))
341 ctors [fromNoninstanciated] = new ConstructorOnTypeBuilderInst (this, fromNoninstanciated);
342 return (ConstructorInfo)ctors [fromNoninstanciated];
345 internal override FieldInfo GetField (FieldInfo fromNoninstanciated)
349 fields = new Hashtable ();
350 if (!fields.ContainsKey (fromNoninstanciated))
351 fields [fromNoninstanciated] = new FieldOnTypeBuilderInst (this, fromNoninstanciated);
352 return (FieldInfo)fields [fromNoninstanciated];
355 public override MethodInfo[] GetMethods (BindingFlags bf)
357 if (!IsCompilerContext)
358 throw new NotSupportedException ();
360 ArrayList l = new ArrayList ();
363 // Walk up our class hierarchy and retrieve methods from our
366 if (!(generic_type is TypeBuilder)) {
367 foreach (var method in generic_type.GetMethods (bf)) {
369 if (m.DeclaringType.IsGenericTypeDefinition)
370 m = TypeBuilder.GetMethod (this, m);
374 Type current_type = this;
376 MonoGenericClass gi = current_type as MonoGenericClass;
378 l.AddRange (gi.GetMethodsInternal (bf, this));
379 else if (current_type is TypeBuilder)
380 l.AddRange (current_type.GetMethods (bf));
382 // If we encounter a `MonoType', its
383 // GetMethodsByName() will return all the methods
384 // from its parent type(s), so we can stop here.
385 MonoType mt = (MonoType) current_type;
386 l.AddRange (mt.GetMethodsByName (null, bf, false, this));
390 if ((bf & BindingFlags.DeclaredOnly) != 0)
392 current_type = current_type.BaseType;
393 } while (current_type != null);
396 MethodInfo[] result = new MethodInfo [l.Count];
401 MethodInfo[] GetMethodsInternal (BindingFlags bf, MonoGenericClass reftype)
404 bf |= BindingFlags.DeclaredOnly; /*To avoid duplicates*/
406 MethodInfo[] methods = GetMethodsFromGTDWithHint (bf);
407 if (methods.Length == 0)
408 return new MethodInfo [0];
410 ArrayList l = new ArrayList ();
412 MethodAttributes mattrs;
416 for (int i = 0; i < methods.Length; ++i) {
417 MethodInfo c = methods [i];
420 mattrs = c.Attributes;
421 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
422 if ((bf & BindingFlags.Public) != 0)
425 if ((bf & BindingFlags.NonPublic) != 0)
431 if ((mattrs & MethodAttributes.Static) != 0) {
432 if ((bf & BindingFlags.Static) != 0)
435 if ((bf & BindingFlags.Instance) != 0)
440 if (c.DeclaringType.IsGenericTypeDefinition)
441 c = TypeBuilder.GetMethod (this, c);
445 MethodInfo[] result = new MethodInfo [l.Count];
450 public override ConstructorInfo[] GetConstructors (BindingFlags bf)
452 if (!IsCompilerContext)
453 throw new NotSupportedException ();
455 ArrayList l = new ArrayList ();
457 Type current_type = this;
459 MonoGenericClass gi = current_type as MonoGenericClass;
461 l.AddRange (gi.GetConstructorsInternal (bf, this));
462 else if (current_type is TypeBuilder)
463 l.AddRange (current_type.GetConstructors (bf));
465 MonoType mt = (MonoType) current_type;
466 l.AddRange (mt.GetConstructors_internal (bf, this));
470 if ((bf & BindingFlags.DeclaredOnly) != 0)
472 current_type = current_type.BaseType;
473 } while (current_type != null);
475 ConstructorInfo[] result = new ConstructorInfo [l.Count];
480 ConstructorInfo[] GetConstructorsInternal (BindingFlags bf, MonoGenericClass reftype)
482 ConstructorInfo[] ctors = GetConstructorsFromGTDWithHint (bf);
483 if (ctors == null || ctors.Length == 0)
484 return new ConstructorInfo [0];
486 ArrayList l = new ArrayList ();
488 MethodAttributes mattrs;
492 for (int i = 0; i < ctors.Length; i++) {
493 ConstructorInfo c = ctors [i];
496 mattrs = c.Attributes;
497 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
498 if ((bf & BindingFlags.Public) != 0)
501 if ((bf & BindingFlags.NonPublic) != 0)
507 if ((mattrs & MethodAttributes.Static) != 0) {
508 if ((bf & BindingFlags.Static) != 0)
511 if ((bf & BindingFlags.Instance) != 0)
516 l.Add (TypeBuilder.GetConstructor (this, c));
519 ConstructorInfo[] result = new ConstructorInfo [l.Count];
524 public override FieldInfo[] GetFields (BindingFlags bf)
526 if (!IsCompilerContext)
527 throw new NotSupportedException ();
529 ArrayList l = new ArrayList ();
531 Type current_type = this;
533 MonoGenericClass gi = current_type as MonoGenericClass;
535 l.AddRange (gi.GetFieldsInternal (bf, this));
536 else if (current_type is TypeBuilder)
537 l.AddRange (current_type.GetFields (bf));
539 MonoType mt = (MonoType) current_type;
540 l.AddRange (mt.GetFields_internal (bf, this));
544 if ((bf & BindingFlags.DeclaredOnly) != 0)
546 current_type = current_type.BaseType;
547 } while (current_type != null);
549 FieldInfo[] result = new FieldInfo [l.Count];
554 FieldInfo[] GetFieldsInternal (BindingFlags bf, MonoGenericClass reftype)
556 FieldInfo[] fields = GetFieldsFromGTD (bf);
557 if (fields.Length == 0)
558 return new FieldInfo [0];
560 ArrayList l = new ArrayList ();
562 FieldAttributes fattrs;
566 for (int i = 0; i < fields.Length; i++) {
567 FieldInfo c = fields [i];
570 fattrs = c.Attributes;
571 if ((fattrs & FieldAttributes.FieldAccessMask) == FieldAttributes.Public) {
572 if ((bf & BindingFlags.Public) != 0)
575 if ((bf & BindingFlags.NonPublic) != 0)
581 if ((fattrs & FieldAttributes.Static) != 0) {
582 if ((bf & BindingFlags.Static) != 0)
585 if ((bf & BindingFlags.Instance) != 0)
590 l.Add (TypeBuilder.GetField (this, c));
593 FieldInfo[] result = new FieldInfo [l.Count];
598 public override PropertyInfo[] GetProperties (BindingFlags bf)
600 if (!IsCompilerContext)
601 throw new NotSupportedException ();
603 ArrayList l = new ArrayList ();
605 Type current_type = this;
607 MonoGenericClass gi = current_type as MonoGenericClass;
609 l.AddRange (gi.GetPropertiesInternal (bf, this));
610 else if (current_type is TypeBuilder)
611 l.AddRange (current_type.GetProperties (bf));
613 MonoType mt = (MonoType) current_type;
614 l.AddRange (mt.GetPropertiesByName (null, bf, false, this));
618 if ((bf & BindingFlags.DeclaredOnly) != 0)
620 current_type = current_type.BaseType;
621 } while (current_type != null);
623 PropertyInfo[] result = new PropertyInfo [l.Count];
628 PropertyInfo[] GetPropertiesInternal (BindingFlags bf, MonoGenericClass reftype)
630 PropertyInfo[] props = GetPropertiesInternal (generic_type, bf);
631 if (props == null || props.Length == 0)
632 return new PropertyInfo [0];
634 ArrayList l = new ArrayList ();
636 MethodAttributes mattrs;
641 foreach (PropertyInfo pinfo in props) {
643 accessor = pinfo.GetGetMethod (true);
644 if (accessor == null)
645 accessor = pinfo.GetSetMethod (true);
646 if (accessor == null)
648 mattrs = accessor.Attributes;
649 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
650 if ((bf & BindingFlags.Public) != 0)
653 if ((bf & BindingFlags.NonPublic) != 0)
659 if ((mattrs & MethodAttributes.Static) != 0) {
660 if ((bf & BindingFlags.Static) != 0)
663 if ((bf & BindingFlags.Instance) != 0)
668 l.Add (new PropertyOnTypeBuilderInst (reftype, pinfo));
670 PropertyInfo[] result = new PropertyInfo [l.Count];
675 public override EventInfo[] GetEvents (BindingFlags bf)
677 if (!IsCompilerContext)
678 throw new NotSupportedException ();
680 ArrayList l = new ArrayList ();
682 Type current_type = this;
684 MonoGenericClass gi = current_type as MonoGenericClass;
686 l.AddRange (gi.GetEventsInternal (bf, this));
687 else if (current_type is TypeBuilder)
688 l.AddRange (current_type.GetEvents (bf));
690 MonoType mt = (MonoType) current_type;
691 l.AddRange (mt.GetEvents (bf));
695 if ((bf & BindingFlags.DeclaredOnly) != 0)
697 current_type = current_type.BaseType;
698 } while (current_type != null);
700 EventInfo[] result = new EventInfo [l.Count];
705 EventInfo[] GetEventsInternal (BindingFlags bf, MonoGenericClass reftype) {
706 TypeBuilder tb = generic_type as TypeBuilder;
708 EventInfo[] res = generic_type.GetEvents (bf);
709 for (int i = 0; i < res.Length; ++i)
710 res [i] = new EventOnTypeBuilderInst (this, res [i]);
713 EventBuilder[] events = tb.events;
715 if (events == null || events.Length == 0)
716 return new EventInfo [0];
720 ArrayList l = new ArrayList ();
722 MethodAttributes mattrs;
725 for (int i = 0; i < event_count; ++i) {
726 EventBuilder ev = events [i];
729 accessor = ev.add_method;
730 if (accessor == null)
731 accessor = ev.remove_method;
732 if (accessor == null)
734 mattrs = accessor.Attributes;
735 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
736 if ((bf & BindingFlags.Public) != 0)
739 if ((bf & BindingFlags.NonPublic) != 0)
745 if ((mattrs & MethodAttributes.Static) != 0) {
746 if ((bf & BindingFlags.Static) != 0)
749 if ((bf & BindingFlags.Instance) != 0)
754 l.Add (new EventOnTypeBuilderInst (this, ev));
756 EventInfo[] result = new EventInfo [l.Count];
761 public override Type[] GetNestedTypes (BindingFlags bf)
763 return generic_type.GetNestedTypes (bf);
766 public override bool IsAssignableFrom (Type c)
771 Type[] interfaces = GetInterfacesInternal ();
774 if (interfaces == null)
776 foreach (Type t in interfaces)
777 if (c.IsAssignableFrom (t))
782 Type parent = GetParentType ();
784 return c == typeof (object);
786 return c.IsAssignableFrom (parent);
789 public override Type UnderlyingSystemType {
793 public override Assembly Assembly {
794 get { return generic_type.Assembly; }
797 public override Module Module {
798 get { return generic_type.Module; }
801 public override string Name {
802 get { return generic_type.Name; }
805 public override string Namespace {
806 get { return generic_type.Namespace; }
809 public override string FullName {
810 get { return format_name (true, false); }
813 public override string AssemblyQualifiedName {
814 get { return format_name (true, true); }
817 public override Guid GUID {
818 get { throw new NotSupportedException (); }
821 string format_name (bool full_name, bool assembly_qualified)
823 StringBuilder sb = new StringBuilder (generic_type.FullName);
824 bool compiler_ctx = IsCompilerContext;
827 for (int i = 0; i < type_arguments.Length; ++i) {
833 string assemblyName = type_arguments [i].Assembly.FullName;
834 name = type_arguments [i].FullName;
835 if (name != null && assemblyName != null)
836 name = name + ", " + assemblyName;
838 name = type_arguments [i].ToString ();
841 if (compiler_ctx && type_arguments [i].IsGenericParameter)
842 name = type_arguments [i].Name;
853 if (assembly_qualified) {
855 sb.Append (generic_type.Assembly.FullName);
857 return sb.ToString ();
860 public override string ToString ()
862 return format_name (false, false);
865 public override Type GetGenericTypeDefinition ()
870 public override Type[] GetGenericArguments ()
872 Type[] ret = new Type [type_arguments.Length];
873 type_arguments.CopyTo (ret, 0);
877 public override bool ContainsGenericParameters {
879 /*FIXME remove this once compound types are not instantiated using MGC*/
881 return GetElementType ().ContainsGenericParameters;
883 foreach (Type t in type_arguments) {
884 if (t.ContainsGenericParameters)
891 public override bool IsGenericTypeDefinition {
892 get { return false; }
895 public override bool IsGenericType {
896 get { return !HasElementType; }
899 public override Type DeclaringType {
900 get { return InflateType (generic_type.DeclaringType); }
903 public override RuntimeTypeHandle TypeHandle {
905 if (!IsCompilerContext)
906 throw new NotSupportedException ();
911 public override Type MakeArrayType ()
913 return new ArrayType (this, 0);
916 public override Type MakeArrayType (int rank)
919 throw new IndexOutOfRangeException ();
920 return new ArrayType (this, rank);
923 public override Type MakeByRefType ()
925 return new ByRefType (this);
928 public override Type MakePointerType ()
930 return new PointerType (this);
933 public override Type GetElementType ()
935 throw new NotSupportedException ();
938 protected override bool HasElementTypeImpl ()
943 protected override bool IsCOMObjectImpl ()
948 protected override bool IsPrimitiveImpl ()
953 protected override bool IsArrayImpl ()
958 protected override bool IsByRefImpl ()
963 protected override bool IsPointerImpl ()
968 protected override TypeAttributes GetAttributeFlagsImpl ()
970 return generic_type.Attributes;
974 public override Type GetInterface (string name, bool ignoreCase)
976 throw new NotSupportedException ();
979 public override EventInfo GetEvent (string name, BindingFlags bindingAttr)
981 if (!IsCompilerContext)
982 throw new NotSupportedException ();
983 foreach (var evt in GetEvents (bindingAttr)) {
984 if (evt.Name == name)
990 public override FieldInfo GetField( string name, BindingFlags bindingAttr)
992 throw new NotSupportedException ();
995 public override MemberInfo[] GetMembers (BindingFlags bindingAttr)
997 throw new NotSupportedException ();
1000 public override Type GetNestedType (string name, BindingFlags bindingAttr)
1002 throw new NotSupportedException ();
1005 public override object InvokeMember (string name, BindingFlags invokeAttr,
1006 Binder binder, object target, object[] args,
1007 ParameterModifier[] modifiers,
1008 CultureInfo culture, string[] namedParameters)
1010 throw new NotSupportedException ();
1013 protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder,
1014 CallingConventions callConvention, Type[] types,
1015 ParameterModifier[] modifiers)
1017 throw new NotSupportedException ();
1020 protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder,
1021 Type returnType, Type[] types, ParameterModifier[] modifiers)
1023 throw new NotSupportedException ();
1026 protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
1028 CallingConventions callConvention,
1030 ParameterModifier[] modifiers)
1032 if (!IsCompilerContext)
1033 throw new NotSupportedException ();
1034 return MonoType.GetConstructorImpl (GetConstructors (bindingAttr), bindingAttr, binder, callConvention, types, modifiers);
1038 public override bool IsDefined (Type attributeType, bool inherit)
1040 if (!IsCompilerContext)
1041 throw new NotSupportedException ();
1042 return generic_type.IsDefined (attributeType, inherit);
1045 public override object [] GetCustomAttributes (bool inherit)
1047 if (!IsCompilerContext)
1048 throw new NotSupportedException ();
1049 return generic_type.GetCustomAttributes (inherit);
1052 public override object [] GetCustomAttributes (Type attributeType, bool inherit)
1054 if (!IsCompilerContext)
1055 throw new NotSupportedException ();
1056 return generic_type.GetCustomAttributes (attributeType, inherit);