namespace System.Reflection {
-#if NET_2_0
[ComVisible (true)]
[ComDefaultInterfaceAttribute (typeof (_MethodInfo))]
-#endif
[Serializable]
[ClassInterface(ClassInterfaceType.None)]
+#if MOBILE
+ public abstract class MethodInfo: MethodBase {
+#else
public abstract class MethodInfo: MethodBase, _MethodInfo {
-
+#endif
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;} }
-#if NET_2_0
- [MonoTODO]
public virtual Type ReturnType {
get { return null; }
}
-#else
- public abstract Type ReturnType { get; }
-#endif
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)
+#if !MOBILE
+ void _MethodInfo.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
{
- return base.Invoke (obj, parameters);
+ throw new NotImplementedException ();
}
-*/
- void _MethodInfo.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+ Type _MethodInfo.GetType ()
{
- throw new NotImplementedException ();
+ // Required or object::GetType becomes virtual final
+ return base.GetType ();
}
void _MethodInfo.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
{
throw new NotImplementedException ();
}
+#endif
-#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 ());
}
return Type.EmptyTypes;
}
+#if !NET_4_0
public override bool IsGenericMethod {
get {
return false;
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
+
+#if NET_4_5
+ public virtual Delegate CreateDelegate (Type delegateType)
+ {
+ return Delegate.CreateDelegate (delegateType, this);
+ }
+
+ public virtual Delegate CreateDelegate (Type delegateType, object target)
+ {
+ return Delegate.CreateDelegate (delegateType, target, this);
+ }
#endif
}
}