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 () {
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);
return typeImpl.GetInterface (name, ignoreCase);
}
+ [ComVisible (true)]
public override InterfaceMapping GetInterfaceMap( Type interfaceType)
{
return typeImpl.GetInterfaceMap (interfaceType);
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)
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) {
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) {
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
}
}