[bcl] Remove NET_4_5 defines from class libs.
[mono.git] / mcs / class / corlib / System.Reflection / TypeDelegator.cs
index 43f064d74c444ee11bd8802fc2df9ecead2da293..8beffb64cd216b1469aabef6db6e0864f5a16685 100644 (file)
 using System;
 using System.Reflection;
 using System.Globalization;
+using System.Runtime.InteropServices;
 
 namespace System.Reflection {
 
+       [ComVisible (true)]
        [Serializable]
-       public class TypeDelegator : Type {
+       public class TypeDelegator : 
+               TypeInfo, IReflectableType
+       {
                protected Type typeImpl;
        
                protected TypeDelegator () {
@@ -89,18 +93,17 @@ namespace System.Reflection {
 
                protected override TypeAttributes GetAttributeFlagsImpl ()
                {
-                       throw new NotImplementedException ();
-                       //return typeImpl.GetAttributeFlagsImpl ();
+                       return typeImpl.Attributes;
                }
                
                protected override ConstructorInfo GetConstructorImpl (
-                       BindingFlags bindingAttr, Binder binder, CallingConventions cc,
+                       BindingFlags bindingAttr, Binder binder, CallingConventions callConvention,
                        Type[] types, ParameterModifier[] modifiers)
                {
-                       throw new NotImplementedException ();
-                       //return typeImpl.GetConstructorImpl (bindingAttr, binder, callConvention, types, modifiers);
+                       return typeImpl.GetConstructor (bindingAttr, binder, callConvention, types, modifiers);
                }
 
+               [ComVisible (true)]
                public override ConstructorInfo[] GetConstructors( BindingFlags bindingAttr)
                {
                        return typeImpl.GetConstructors (bindingAttr);
@@ -151,6 +154,7 @@ namespace System.Reflection {
                        return typeImpl.GetInterface (name, ignoreCase);
                }
 
+               [ComVisible (true)]
                public override InterfaceMapping GetInterfaceMap( Type interfaceType)
                {
                        return typeImpl.GetInterfaceMap (interfaceType);
@@ -173,8 +177,8 @@ namespace System.Reflection {
 
                protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
                {
-                       throw new NotImplementedException ();
-                       //return typeImpl.GetMethodImpl (name, bindingAttr, binder, callConvention, types, modifiers);
+                       // Can't call GetMethod since it makes restrictive argument checks
+                       return typeImpl.GetMethodImplInternal (name, bindingAttr, binder, callConvention, types, modifiers);
                }
 
                public override MethodInfo[] GetMethods( BindingFlags bindingAttr)
@@ -199,14 +203,13 @@ namespace System.Reflection {
 
                protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
                {
-                       throw new NotImplementedException ();
-                       //return typeImpl.GetPropertyImpl (name, bindingAttr, bindingAttr, returnType, types, modifiers);
+                       // Can't call GetProperty since it makes restrictive argument checks
+                       return typeImpl.GetPropertyImplInternal (name, bindingAttr, binder, returnType, types, modifiers);
                }
 
                protected override bool HasElementTypeImpl()
                {
-                       throw new NotImplementedException ();
-                       //return typeImpl.HasElementTypeImpl ();
+                       return typeImpl.HasElementType;
                }
 
                public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
@@ -215,20 +218,17 @@ namespace System.Reflection {
 
                protected override bool IsArrayImpl()
                {
-                       throw new NotImplementedException ();
-                       //return typeImpl.IsArrayImpl ();
+                       return typeImpl.IsArray;
                }
 
                protected override bool IsByRefImpl()
                {
-                       throw new NotImplementedException ();
-                       //return typeImpl.IsByRefImpl ();
+                       return typeImpl.IsByRef;
                }
 
                protected override bool IsCOMObjectImpl()
                {
-                       throw new NotImplementedException ();
-                       //return typeImpl.IsCOMObjectImpl ();
+                       return typeImpl.IsCOMObject;
                }
 
                public override bool IsDefined( Type attributeType, bool inherit) {
@@ -237,57 +237,36 @@ namespace System.Reflection {
 
                protected override bool IsPointerImpl()
                {
-                       throw new NotImplementedException ();
-                       //return typeImpl.IsPointerImpl ();
+                       return typeImpl.IsPointer;
                }
 
                protected override bool IsPrimitiveImpl()
                {
-                       throw new NotImplementedException ();
-                       //return typeImpl.IsPrimitiveImpl ();
+                       return typeImpl.IsPrimitive;
                }
 
                protected override bool IsValueTypeImpl()
                {
-                       throw new NotImplementedException ();
-                       //return typeImpl.IsValueTypeImpl ();
-               }
-#if NET_2_0 || BOOTSTRAP_NET_2_0
-               public override Type[] GetGenericArguments ()
-               {
-                       throw new NotImplementedException ();
+                       return typeImpl.IsValueType;
                }
 
-               public override bool HasGenericArguments {
+               public override int MetadataToken {
                        get {
-                               throw new NotImplementedException ();
+                               return typeImpl.MetadataToken;
                        }
                }
 
-               public override bool ContainsGenericParameters {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               public override bool IsGenericParameter {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+               public override bool IsConstructedGenericType {
+                       get { return typeImpl.IsConstructedGenericType; }
                }
 
-               public override int GenericParameterPosition {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
+               public override bool IsAssignableFrom (TypeInfo typeInfo)
+               {
+                       if (typeInfo == null)
+                               throw new ArgumentNullException ("typeInfo");
 
-               public override MethodInfo DeclaringMethod {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+                       return IsAssignableFrom (typeInfo.AsType ());
                }
-#endif
 
        }
 }