MethodInfo.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. namespace System.Reflection
  5. {
  6. public abstract partial class MethodInfo : MethodBase
  7. {
  8. protected MethodInfo() { }
  9. public override MemberTypes MemberType => MemberTypes.Method;
  10. public virtual ParameterInfo ReturnParameter { get { throw NotImplemented.ByDesign; } }
  11. public virtual Type ReturnType { get { throw NotImplemented.ByDesign; } }
  12. public override Type[] GetGenericArguments() { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
  13. public virtual MethodInfo GetGenericMethodDefinition() { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
  14. public virtual MethodInfo MakeGenericMethod(params Type[] typeArguments) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
  15. public abstract MethodInfo GetBaseDefinition();
  16. public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
  17. public virtual Delegate CreateDelegate(Type delegateType) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
  18. public virtual Delegate CreateDelegate(Type delegateType, object target) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
  19. public override bool Equals(object obj) => base.Equals(obj);
  20. public override int GetHashCode() => base.GetHashCode();
  21. public static bool operator ==(MethodInfo left, MethodInfo right)
  22. {
  23. if (object.ReferenceEquals(left, right))
  24. return true;
  25. if ((object)left == null || (object)right == null)
  26. return false;
  27. return left.Equals(right);
  28. }
  29. public static bool operator !=(MethodInfo left, MethodInfo right) => !(left == right);
  30. }
  31. }