X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem.Reflection%2FMethodInfo.cs;h=4b76a5d89cc22647a0db11a6ae62cb5e94214cd8;hb=089b4086dc4639288dec762546b729d9080fc81a;hp=0624a0726abf78ce731f426650cffa361360f4c8;hpb=9d61782c6e2392d7ceec2006b35be582598a70ae;p=mono.git diff --git a/mcs/class/corlib/System.Reflection/MethodInfo.cs b/mcs/class/corlib/System.Reflection/MethodInfo.cs index 0624a0726ab..4b76a5d89cc 100644 --- a/mcs/class/corlib/System.Reflection/MethodInfo.cs +++ b/mcs/class/corlib/System.Reflection/MethodInfo.cs @@ -33,40 +33,30 @@ using System.Runtime.InteropServices; namespace System.Reflection { -#if NET_2_0 [ComVisible (true)] [ComDefaultInterfaceAttribute (typeof (_MethodInfo))] -#endif [Serializable] [ClassInterface(ClassInterfaceType.None)] public abstract class MethodInfo: MethodBase, _MethodInfo { public abstract MethodInfo GetBaseDefinition(); - protected MethodInfo() { + internal virtual MethodInfo GetBaseMethod () + { + return this; } -#if ONLY_1_1 - public new Type GetType () - { - return base.GetType (); + protected MethodInfo() { } -#endif + public override MemberTypes MemberType { get {return MemberTypes.Method;} } - public abstract Type ReturnType { get; } - public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; } - // FIXME: when this method is uncommented, corlib fails - // to build -/* - [DebuggerStepThrough] - [DebuggerHidden] - public new object Invoke (object obj, object[] parameters) - { - return base.Invoke (obj, parameters); + public virtual Type ReturnType { + get { return null; } } -*/ + + public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; } void _MethodInfo.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId) { @@ -88,22 +78,79 @@ namespace System.Reflection { throw new NotImplementedException (); } -#if NET_2_0 || BOOTSTRAP_NET_2_0 + [ComVisible (true)] public virtual MethodInfo GetGenericMethodDefinition () { throw new NotSupportedException (); } - public virtual MethodInfo MakeGenericMethod (params Type [] types) + public virtual MethodInfo MakeGenericMethod (params Type [] typeArguments) { throw new NotSupportedException (this.GetType().ToString ()); } + // GetGenericArguments, IsGenericMethod, IsGenericMethodDefinition + // and ContainsGenericParameters are implemented in the derived classes. + [ComVisible (true)] + public override Type [] GetGenericArguments () { + return Type.EmptyTypes; + } + +#if !NET_4_0 && !MOONLIGHT + public override bool IsGenericMethod { + get { + return false; + } + } + + public override bool IsGenericMethodDefinition { + get { + return false; + } + } + + public override bool ContainsGenericParameters { + get { + return false; + } + } +#endif + public virtual ParameterInfo ReturnParameter { get { throw new NotSupportedException (); } } + +#if NET_4_0 + public override bool Equals (object obj) + { + return obj == (object) this; + } + + public override int GetHashCode () + { + return base.GetHashCode (); + } + + public static bool operator == (MethodInfo left, MethodInfo right) + { + if ((object)left == (object)right) + return true; + if ((object)left == null ^ (object)right == null) + return false; + return left.Equals (right); + } + + public static bool operator != (MethodInfo left, MethodInfo right) + { + if ((object)left == (object)right) + return false; + if ((object)left == null ^ (object)right == null) + return true; + return !left.Equals (right); + } #endif + } }