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;
75 This is a temporary hack until we can fix the rest of the runtime
76 to properly handle this class to be a complete UT.
78 We must not regisrer this with the runtime after the type is created
79 otherwise created_type.MakeGenericType will return an instance of MonoGenericClass,
80 which is very very broken.
82 if (tb is TypeBuilder && !(tb as TypeBuilder).is_created)
83 register_with_runtime (this);
88 internal override bool IsCompilerContext {
90 if (is_compiler_context == 0) {
91 bool is_cc = generic_type.IsCompilerContext;
92 foreach (Type t in type_arguments)
93 is_cc |= t.IsCompilerContext;
94 is_compiler_context = is_cc ? 1 : -1;
96 return is_compiler_context == 1;
100 internal override Type InternalResolve ()
102 Type gtd = generic_type.InternalResolve ();
103 Type[] args = new Type [type_arguments.Length];
104 for (int i = 0; i < type_arguments.Length; ++i)
105 args [i] = type_arguments [i].InternalResolve ();
106 return gtd.MakeGenericType (args);
109 [MethodImplAttribute(MethodImplOptions.InternalCall)]
110 extern void initialize (MethodInfo[] methods, ConstructorInfo[] ctors, FieldInfo[] fields, PropertyInfo[] properties, EventInfo[] events);
112 [MethodImplAttribute(MethodImplOptions.InternalCall)]
113 internal static extern void register_with_runtime (Type type);
115 EventInfo[] GetEventsFromGTD (BindingFlags flags) {
116 TypeBuilder tb = generic_type as TypeBuilder;
118 return generic_type.GetEvents (flags);
120 return tb.GetEvents_internal (flags);
123 ConstructorInfo[] GetConstructorsFromGTD (BindingFlags flags)
125 TypeBuilder tb = generic_type as TypeBuilder;
127 return generic_type.GetConstructors (flags);
129 return tb.GetConstructorsInternal (flags);
133 MethodInfo[] GetMethodsFromGTD (BindingFlags bf)
135 TypeBuilder tb = generic_type as TypeBuilder;
137 return generic_type.GetMethods (bf);
139 MethodInfo[] res = new MethodInfo [tb.num_methods];
140 if (tb.num_methods > 0)
141 Array.Copy (tb.methods, res, tb.num_methods);
147 FieldInfo[] GetFieldsFromGTD (BindingFlags bf)
149 TypeBuilder tb = generic_type as TypeBuilder;
151 return generic_type.GetFields (bf);
153 FieldInfo[] res = new FieldInfo [tb.num_fields];
154 if (tb.num_fields > 0)
155 Array.Copy (tb.fields, res, tb.num_fields);
160 /*@hint might not be honored so it required aditional filtering
161 TODO move filtering into here for the TypeBuilder case and remove the hint ugliness
163 MethodInfo[] GetMethodsFromGTDWithHint (BindingFlags hint)
165 TypeBuilder tb = generic_type as TypeBuilder;
167 return generic_type.GetMethods (hint);
169 if (tb.num_methods == 0)
170 return new MethodInfo [0];
171 MethodInfo[] res = new MethodInfo [tb.num_methods];
172 Array.Copy (tb.methods, 0, res, 0, tb.num_methods);
176 /*@hint might not be honored so it required aditional filtering
177 TODO move filtering into here for the TypeBuilder case and remove the hint ugliness
179 ConstructorInfo[] GetConstructorsFromGTDWithHint (BindingFlags hint)
181 TypeBuilder tb = generic_type as TypeBuilder;
183 return generic_type.GetConstructors (hint);
185 if (tb.ctors == null)
186 return new ConstructorInfo [0];
187 ConstructorInfo[] res = new ConstructorInfo [tb.ctors.Length];
188 tb.ctors.CopyTo (res, 0);
192 static Type PeelType (Type t) {
193 if (t.HasElementType)
194 return PeelType (t.GetElementType ());
195 if (t.IsGenericType && !t.IsGenericParameter)
196 return t.GetGenericTypeDefinition ();
200 static PropertyInfo[] GetPropertiesInternal (Type type, BindingFlags bf)
202 TypeBuilder tb = type as TypeBuilder;
204 return tb.properties;
205 return type.GetProperties (bf);
208 Type[] GetInterfacesFromGTD ()
210 TypeBuilder tb = generic_type as TypeBuilder;
212 return tb.interfaces;
213 return generic_type.GetInterfaces ();
216 internal bool IsCreated {
218 TypeBuilder tb = generic_type as TypeBuilder;
219 return tb != null ? tb.is_created : true;
223 private const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic |
224 BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
231 MonoGenericClass parent = GetParentType () as MonoGenericClass;
233 parent.initialize ();
234 EventInfo[] events = GetEventsFromGTD (flags);
235 event_count = events.Length;
237 initialize (generic_type.GetMethods (flags),
238 GetConstructorsFromGTD (flags),
239 generic_type.GetFields (flags),
240 generic_type.GetProperties (flags),
246 Type GetParentType ()
248 return InflateType (generic_type.BaseType);
251 internal Type InflateType (Type type)
253 return InflateType (type, type_arguments, null);
256 internal Type InflateType (Type type, Type[] method_args)
258 return InflateType (type, type_arguments, method_args);
261 internal static Type InflateType (Type type, Type[] type_args, Type[] method_args)
265 if (!type.IsGenericParameter && !type.ContainsGenericParameters)
267 if (type.IsGenericParameter) {
268 if (type.DeclaringMethod == null)
269 return type_args == null ? type : type_args [type.GenericParameterPosition];
270 return method_args == null ? type : method_args [type.GenericParameterPosition];
273 return InflateType (type.GetElementType (), type_args, method_args).MakePointerType ();
275 return InflateType (type.GetElementType (), type_args, method_args).MakeByRefType ();
277 if (type.GetArrayRank () > 1)
278 return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType (type.GetArrayRank ());
280 if (type.ToString ().EndsWith ("[*]", StringComparison.Ordinal)) /*FIXME, the reflection API doesn't offer a way around this*/
281 return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType (1);
282 return InflateType (type.GetElementType (), type_args, method_args).MakeArrayType ();
285 Type[] args = type.GetGenericArguments ();
286 for (int i = 0; i < args.Length; ++i)
287 args [i] = InflateType (args [i], type_args, method_args);
289 Type gtd = type.IsGenericTypeDefinition ? type : type.GetGenericTypeDefinition ();
290 return gtd.MakeGenericType (args);
293 public override Type BaseType {
295 Type parent = GetParentType ();
296 return parent != null ? parent : generic_type.BaseType;
300 Type[] GetInterfacesInternal ()
302 Type[] ifaces = GetInterfacesFromGTD ();
305 Type[] res = new Type [ifaces.Length];
306 for (int i = 0; i < res.Length; ++i)
307 res [i] = InflateType (ifaces [i]);
311 public override Type[] GetInterfaces ()
313 if (!IsCompilerContext) {
314 Console.WriteLine ("--FAIL {0}", this);
315 Console.WriteLine ("\tgt {0}/{1}/{2}", generic_type, generic_type.IsCompilerContext, generic_type.GetType ());
317 foreach (Type t in type_arguments)
318 Console.WriteLine ("\targ {0}/{1}/{2}", t, t.IsCompilerContext, t.GetType ());
320 throw new NotSupportedException ();
322 return GetInterfacesInternal ();
325 protected override bool IsValueTypeImpl ()
327 return generic_type.IsValueType;
330 internal override MethodInfo GetMethod (MethodInfo fromNoninstanciated)
335 methods = new Hashtable ();
336 if (!methods.ContainsKey (fromNoninstanciated))
337 methods [fromNoninstanciated] = new MethodOnTypeBuilderInst (this, fromNoninstanciated);
338 return (MethodInfo)methods [fromNoninstanciated];
341 internal override ConstructorInfo GetConstructor (ConstructorInfo fromNoninstanciated)
346 ctors = new Hashtable ();
347 if (!ctors.ContainsKey (fromNoninstanciated))
348 ctors [fromNoninstanciated] = new ConstructorOnTypeBuilderInst (this, fromNoninstanciated);
349 return (ConstructorInfo)ctors [fromNoninstanciated];
352 internal override FieldInfo GetField (FieldInfo fromNoninstanciated)
356 fields = new Hashtable ();
357 if (!fields.ContainsKey (fromNoninstanciated))
358 fields [fromNoninstanciated] = new FieldOnTypeBuilderInst (this, fromNoninstanciated);
359 return (FieldInfo)fields [fromNoninstanciated];
362 public override MethodInfo[] GetMethods (BindingFlags bf)
364 if (!IsCompilerContext)
365 throw new NotSupportedException ();
367 ArrayList l = new ArrayList ();
370 // Walk up our class hierarchy and retrieve methods from our
373 if (!(generic_type is TypeBuilder)) {
374 foreach (var method in generic_type.GetMethods (bf)) {
376 if (m.DeclaringType.IsGenericTypeDefinition)
377 m = TypeBuilder.GetMethod (this, m);
381 Type current_type = this;
383 MonoGenericClass gi = current_type as MonoGenericClass;
385 l.AddRange (gi.GetMethodsInternal (bf, this));
386 else if (current_type is TypeBuilder)
387 l.AddRange (current_type.GetMethods (bf));
389 // If we encounter a `MonoType', its
390 // GetMethodsByName() will return all the methods
391 // from its parent type(s), so we can stop here.
392 MonoType mt = (MonoType) current_type;
393 l.AddRange (mt.GetMethodsByName (null, bf, false, this));
397 if ((bf & BindingFlags.DeclaredOnly) != 0)
399 current_type = current_type.BaseType;
400 } while (current_type != null);
403 MethodInfo[] result = new MethodInfo [l.Count];
408 MethodInfo[] GetMethodsInternal (BindingFlags bf, MonoGenericClass reftype)
411 bf |= BindingFlags.DeclaredOnly; /*To avoid duplicates*/
413 MethodInfo[] methods = GetMethodsFromGTDWithHint (bf);
414 if (methods.Length == 0)
415 return new MethodInfo [0];
417 ArrayList l = new ArrayList ();
419 MethodAttributes mattrs;
423 for (int i = 0; i < methods.Length; ++i) {
424 MethodInfo c = methods [i];
427 mattrs = c.Attributes;
428 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
429 if ((bf & BindingFlags.Public) != 0)
432 if ((bf & BindingFlags.NonPublic) != 0)
438 if ((mattrs & MethodAttributes.Static) != 0) {
439 if ((bf & BindingFlags.Static) != 0)
442 if ((bf & BindingFlags.Instance) != 0)
447 if (c.DeclaringType.IsGenericTypeDefinition)
448 c = TypeBuilder.GetMethod (this, c);
452 MethodInfo[] result = new MethodInfo [l.Count];
457 public override ConstructorInfo[] GetConstructors (BindingFlags bf)
459 if (!IsCompilerContext)
460 throw new NotSupportedException ();
462 ArrayList l = new ArrayList ();
464 Type current_type = this;
466 MonoGenericClass gi = current_type as MonoGenericClass;
468 l.AddRange (gi.GetConstructorsInternal (bf, this));
469 else if (current_type is TypeBuilder)
470 l.AddRange (current_type.GetConstructors (bf));
472 MonoType mt = (MonoType) current_type;
473 l.AddRange (mt.GetConstructors_internal (bf, this));
477 if ((bf & BindingFlags.DeclaredOnly) != 0)
479 current_type = current_type.BaseType;
480 } while (current_type != null);
482 ConstructorInfo[] result = new ConstructorInfo [l.Count];
487 ConstructorInfo[] GetConstructorsInternal (BindingFlags bf, MonoGenericClass reftype)
489 ConstructorInfo[] ctors = GetConstructorsFromGTDWithHint (bf);
490 if (ctors == null || ctors.Length == 0)
491 return new ConstructorInfo [0];
493 ArrayList l = new ArrayList ();
495 MethodAttributes mattrs;
499 for (int i = 0; i < ctors.Length; i++) {
500 ConstructorInfo c = ctors [i];
503 mattrs = c.Attributes;
504 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
505 if ((bf & BindingFlags.Public) != 0)
508 if ((bf & BindingFlags.NonPublic) != 0)
514 if ((mattrs & MethodAttributes.Static) != 0) {
515 if ((bf & BindingFlags.Static) != 0)
518 if ((bf & BindingFlags.Instance) != 0)
523 l.Add (TypeBuilder.GetConstructor (this, c));
526 ConstructorInfo[] result = new ConstructorInfo [l.Count];
531 public override FieldInfo[] GetFields (BindingFlags bf)
533 if (!IsCompilerContext)
534 throw new NotSupportedException ();
536 ArrayList l = new ArrayList ();
538 Type current_type = this;
540 MonoGenericClass gi = current_type as MonoGenericClass;
542 l.AddRange (gi.GetFieldsInternal (bf, this));
543 else if (current_type is TypeBuilder)
544 l.AddRange (current_type.GetFields (bf));
546 MonoType mt = (MonoType) current_type;
547 l.AddRange (mt.GetFields_internal (bf, this));
551 if ((bf & BindingFlags.DeclaredOnly) != 0)
553 current_type = current_type.BaseType;
554 } while (current_type != null);
556 FieldInfo[] result = new FieldInfo [l.Count];
561 FieldInfo[] GetFieldsInternal (BindingFlags bf, MonoGenericClass reftype)
563 FieldInfo[] fields = GetFieldsFromGTD (bf);
564 if (fields.Length == 0)
565 return new FieldInfo [0];
567 ArrayList l = new ArrayList ();
569 FieldAttributes fattrs;
573 for (int i = 0; i < fields.Length; i++) {
574 FieldInfo c = fields [i];
577 fattrs = c.Attributes;
578 if ((fattrs & FieldAttributes.FieldAccessMask) == FieldAttributes.Public) {
579 if ((bf & BindingFlags.Public) != 0)
582 if ((bf & BindingFlags.NonPublic) != 0)
588 if ((fattrs & FieldAttributes.Static) != 0) {
589 if ((bf & BindingFlags.Static) != 0)
592 if ((bf & BindingFlags.Instance) != 0)
597 l.Add (TypeBuilder.GetField (this, c));
600 FieldInfo[] result = new FieldInfo [l.Count];
605 public override PropertyInfo[] GetProperties (BindingFlags bf)
607 if (!IsCompilerContext)
608 throw new NotSupportedException ();
610 ArrayList l = new ArrayList ();
612 Type current_type = this;
614 MonoGenericClass gi = current_type as MonoGenericClass;
616 l.AddRange (gi.GetPropertiesInternal (bf, this));
617 else if (current_type is TypeBuilder)
618 l.AddRange (current_type.GetProperties (bf));
620 MonoType mt = (MonoType) current_type;
621 l.AddRange (mt.GetPropertiesByName (null, bf, false, this));
625 if ((bf & BindingFlags.DeclaredOnly) != 0)
627 current_type = current_type.BaseType;
628 } while (current_type != null);
630 PropertyInfo[] result = new PropertyInfo [l.Count];
635 PropertyInfo[] GetPropertiesInternal (BindingFlags bf, MonoGenericClass reftype)
637 PropertyInfo[] props = GetPropertiesInternal (generic_type, bf);
638 if (props == null || props.Length == 0)
639 return new PropertyInfo [0];
641 ArrayList l = new ArrayList ();
643 MethodAttributes mattrs;
648 foreach (PropertyInfo pinfo in props) {
650 accessor = pinfo.GetGetMethod (true);
651 if (accessor == null)
652 accessor = pinfo.GetSetMethod (true);
653 if (accessor == null)
655 mattrs = accessor.Attributes;
656 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
657 if ((bf & BindingFlags.Public) != 0)
660 if ((bf & BindingFlags.NonPublic) != 0)
666 if ((mattrs & MethodAttributes.Static) != 0) {
667 if ((bf & BindingFlags.Static) != 0)
670 if ((bf & BindingFlags.Instance) != 0)
675 l.Add (new PropertyOnTypeBuilderInst (reftype, pinfo));
677 PropertyInfo[] result = new PropertyInfo [l.Count];
682 public override EventInfo[] GetEvents (BindingFlags bf)
684 if (!IsCompilerContext)
685 throw new NotSupportedException ();
687 ArrayList l = new ArrayList ();
689 Type current_type = this;
691 MonoGenericClass gi = current_type as MonoGenericClass;
693 l.AddRange (gi.GetEventsInternal (bf, this));
694 else if (current_type is TypeBuilder)
695 l.AddRange (current_type.GetEvents (bf));
697 MonoType mt = (MonoType) current_type;
698 l.AddRange (mt.GetEvents (bf));
702 if ((bf & BindingFlags.DeclaredOnly) != 0)
704 current_type = current_type.BaseType;
705 } while (current_type != null);
707 EventInfo[] result = new EventInfo [l.Count];
712 EventInfo[] GetEventsInternal (BindingFlags bf, MonoGenericClass reftype) {
713 TypeBuilder tb = generic_type as TypeBuilder;
715 EventInfo[] res = generic_type.GetEvents (bf);
716 for (int i = 0; i < res.Length; ++i)
717 res [i] = new EventOnTypeBuilderInst (this, res [i]);
720 EventBuilder[] events = tb.events;
722 if (events == null || events.Length == 0)
723 return new EventInfo [0];
727 ArrayList l = new ArrayList ();
729 MethodAttributes mattrs;
732 for (int i = 0; i < event_count; ++i) {
733 EventBuilder ev = events [i];
736 accessor = ev.add_method;
737 if (accessor == null)
738 accessor = ev.remove_method;
739 if (accessor == null)
741 mattrs = accessor.Attributes;
742 if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
743 if ((bf & BindingFlags.Public) != 0)
746 if ((bf & BindingFlags.NonPublic) != 0)
752 if ((mattrs & MethodAttributes.Static) != 0) {
753 if ((bf & BindingFlags.Static) != 0)
756 if ((bf & BindingFlags.Instance) != 0)
761 l.Add (new EventOnTypeBuilderInst (this, ev));
763 EventInfo[] result = new EventInfo [l.Count];
768 public override Type[] GetNestedTypes (BindingFlags bf)
770 return generic_type.GetNestedTypes (bf);
773 public override bool IsAssignableFrom (Type c)
778 Type[] interfaces = GetInterfacesInternal ();
781 if (interfaces == null)
783 foreach (Type t in interfaces)
784 if (c.IsAssignableFrom (t))
789 Type parent = GetParentType ();
791 return c == typeof (object);
793 return c.IsAssignableFrom (parent);
796 public override Type UnderlyingSystemType {
800 public override Assembly Assembly {
801 get { return generic_type.Assembly; }
804 public override Module Module {
805 get { return generic_type.Module; }
808 public override string Name {
809 get { return generic_type.Name; }
812 public override string Namespace {
813 get { return generic_type.Namespace; }
816 public override string FullName {
817 get { return format_name (true, false); }
820 public override string AssemblyQualifiedName {
821 get { return format_name (true, true); }
824 public override Guid GUID {
825 get { throw new NotSupportedException (); }
828 string format_name (bool full_name, bool assembly_qualified)
830 StringBuilder sb = new StringBuilder (generic_type.FullName);
831 bool compiler_ctx = IsCompilerContext;
834 for (int i = 0; i < type_arguments.Length; ++i) {
840 string assemblyName = type_arguments [i].Assembly.FullName;
841 name = type_arguments [i].FullName;
842 if (name != null && assemblyName != null)
843 name = name + ", " + assemblyName;
845 name = type_arguments [i].ToString ();
848 if (compiler_ctx && type_arguments [i].IsGenericParameter)
849 name = type_arguments [i].Name;
860 if (assembly_qualified) {
862 sb.Append (generic_type.Assembly.FullName);
864 return sb.ToString ();
867 public override string ToString ()
869 return format_name (false, false);
872 public override Type GetGenericTypeDefinition ()
877 public override Type[] GetGenericArguments ()
879 Type[] ret = new Type [type_arguments.Length];
880 type_arguments.CopyTo (ret, 0);
884 public override bool ContainsGenericParameters {
886 /*FIXME remove this once compound types are not instantiated using MGC*/
888 return GetElementType ().ContainsGenericParameters;
890 foreach (Type t in type_arguments) {
891 if (t.ContainsGenericParameters)
898 public override bool IsGenericTypeDefinition {
899 get { return false; }
902 public override bool IsGenericType {
903 get { return !HasElementType; }
906 public override Type DeclaringType {
907 get { return InflateType (generic_type.DeclaringType); }
910 public override RuntimeTypeHandle TypeHandle {
912 if (!IsCompilerContext)
913 throw new NotSupportedException ();
918 public override Type MakeArrayType ()
920 return new ArrayType (this, 0);
923 public override Type MakeArrayType (int rank)
926 throw new IndexOutOfRangeException ();
927 return new ArrayType (this, rank);
930 public override Type MakeByRefType ()
932 return new ByRefType (this);
935 public override Type MakePointerType ()
937 return new PointerType (this);
940 public override Type GetElementType ()
942 throw new NotSupportedException ();
945 protected override bool HasElementTypeImpl ()
950 protected override bool IsCOMObjectImpl ()
955 protected override bool IsPrimitiveImpl ()
960 protected override bool IsArrayImpl ()
965 protected override bool IsByRefImpl ()
970 protected override bool IsPointerImpl ()
975 protected override TypeAttributes GetAttributeFlagsImpl ()
977 return generic_type.Attributes;
981 public override Type GetInterface (string name, bool ignoreCase)
983 throw new NotSupportedException ();
986 public override EventInfo GetEvent (string name, BindingFlags bindingAttr)
988 if (!IsCompilerContext)
989 throw new NotSupportedException ();
990 foreach (var evt in GetEvents (bindingAttr)) {
991 if (evt.Name == name)
997 public override FieldInfo GetField( string name, BindingFlags bindingAttr)
999 throw new NotSupportedException ();
1002 public override MemberInfo[] GetMembers (BindingFlags bindingAttr)
1004 throw new NotSupportedException ();
1007 public override Type GetNestedType (string name, BindingFlags bindingAttr)
1009 throw new NotSupportedException ();
1012 public override object InvokeMember (string name, BindingFlags invokeAttr,
1013 Binder binder, object target, object[] args,
1014 ParameterModifier[] modifiers,
1015 CultureInfo culture, string[] namedParameters)
1017 throw new NotSupportedException ();
1020 protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder,
1021 CallingConventions callConvention, Type[] types,
1022 ParameterModifier[] modifiers)
1024 throw new NotSupportedException ();
1027 protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder,
1028 Type returnType, Type[] types, ParameterModifier[] modifiers)
1030 throw new NotSupportedException ();
1033 protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
1035 CallingConventions callConvention,
1037 ParameterModifier[] modifiers)
1039 if (!IsCompilerContext)
1040 throw new NotSupportedException ();
1041 return MonoType.GetConstructorImpl (GetConstructors (bindingAttr), bindingAttr, binder, callConvention, types, modifiers);
1045 public override bool IsDefined (Type attributeType, bool inherit)
1047 if (!IsCompilerContext)
1048 throw new NotSupportedException ();
1049 return generic_type.IsDefined (attributeType, inherit);
1052 public override object [] GetCustomAttributes (bool inherit)
1054 if (!IsCompilerContext)
1055 throw new NotSupportedException ();
1056 return generic_type.GetCustomAttributes (inherit);
1059 public override object [] GetCustomAttributes (Type attributeType, bool inherit)
1061 if (!IsCompilerContext)
1062 throw new NotSupportedException ();
1063 return generic_type.GetCustomAttributes (attributeType, inherit);