- EventInfo[] GetEventsFromGTD (BindingFlags flags) {
- TypeBuilder tb = generic_type as TypeBuilder;
- if (tb == null)
- return generic_type.GetEvents (flags);
-
- return tb.GetEvents_internal (flags);
- }
-
- ConstructorInfo[] GetConstructorsFromGTD (BindingFlags flags)
- {
- TypeBuilder tb = generic_type as TypeBuilder;
- if (tb == null)
- return generic_type.GetConstructors (flags);
-
- return tb.GetConstructorsInternal (flags);
- }
-
- /*
- MethodInfo[] GetMethodsFromGTD (BindingFlags bf)
- {
- TypeBuilder tb = generic_type as TypeBuilder;
- if (tb == null)
- return generic_type.GetMethods (bf);
-
- MethodInfo[] res = new MethodInfo [tb.num_methods];
- if (tb.num_methods > 0)
- Array.Copy (tb.methods, res, tb.num_methods);
-
- return res;
- }
- */
-
- FieldInfo[] GetFieldsFromGTD (BindingFlags bf)
- {
- TypeBuilder tb = generic_type as TypeBuilder;
- if (tb == null)
- return generic_type.GetFields (bf);
-
- FieldInfo[] res = new FieldInfo [tb.num_fields];
- if (tb.num_fields > 0)
- Array.Copy (tb.fields, res, tb.num_fields);
-
- return res;
- }
-
- /*@hint might not be honored so it required aditional filtering
- TODO move filtering into here for the TypeBuilder case and remove the hint ugliness
- */
- MethodInfo[] GetMethodsFromGTDWithHint (BindingFlags hint)
- {
- TypeBuilder tb = generic_type as TypeBuilder;
- if (tb == null)
- return generic_type.GetMethods (hint);
-
- if (tb.num_methods == 0)
- return new MethodInfo [0];
- MethodInfo[] res = new MethodInfo [tb.num_methods];
- Array.Copy (tb.methods, 0, res, 0, tb.num_methods);
- return res;
- }
-
- /*@hint might not be honored so it required aditional filtering
- TODO move filtering into here for the TypeBuilder case and remove the hint ugliness
- */
- ConstructorInfo[] GetConstructorsFromGTDWithHint (BindingFlags hint)
- {
- TypeBuilder tb = generic_type as TypeBuilder;
- if (tb == null)
- return generic_type.GetConstructors (hint);
-
- if (tb.ctors == null)
- return new ConstructorInfo [0];
- ConstructorInfo[] res = new ConstructorInfo [tb.ctors.Length];
- tb.ctors.CopyTo (res, 0);
- return res;
- }
-
- static Type PeelType (Type t) {
- if (t.HasElementType)
- return PeelType (t.GetElementType ());
- if (t.IsGenericType && !t.IsGenericParameter)
- return t.GetGenericTypeDefinition ();
- return t;
- }
-
- static PropertyInfo[] GetPropertiesInternal (Type type, BindingFlags bf)
- {
- TypeBuilder tb = type as TypeBuilder;
- if (tb != null)
- return tb.properties;
- return type.GetProperties (bf);
- }
-
- Type[] GetInterfacesFromGTD ()
- {
- TypeBuilder tb = generic_type as TypeBuilder;
- if (tb != null)
- return tb.interfaces;
- return generic_type.GetInterfaces ();
- }
-