final class · System.Reflection
MethodInfo
public final class MethodInfo : MethodBase
A method: its result type, and calls through Invoke(target, arguments).
- Kind
- final class
- Namespace
- System.Reflection
- Assembly
- System.Core
- Access
- public, final
- Source file
Reflection.ant
Inheritance
- Base classes
-
AnyMemberInfoMethodBaseMethodInfo
Properties
A method with its own type parameters (it cannot be called through Invoke).
Methods
Invoke(any? target, any?[] arguments) : any?
#
Calls the method on target (null for a static method) with arguments: its result, boxed (null for none).
override ToString() : str
#
Private and internal members (3)
new(Type declaring, str name, i32 flags, TypeDescriber describer, i32 index, Type returnType, ParameterInfo[] parameters)
#
SameAs(MethodInfo other) : bool
#
Whether other is the same method seen from a class below (an override).
Inherited members (12)
GetParametersmethod from MethodBaseGetCustomAttributesmethod from MemberInfoGetCustomAttributesmethod from MemberInfoIsDefinedmethod from MemberInfoNameproperty from MemberInfoDeclaringTypeproperty from MemberInfoIsPublicproperty from MemberInfoIsStaticproperty from MemberInfoGetTypemethod from AnyUndescribedmethod from AnyHashmethod from Anydestroymethod from Any
Source
MethodInfo as Antril, decompiled from its Larva HIR.
// System.Reflection.MethodInfo — System.Core (decompiled from Larva HIR)
import System;
into namespace System.Reflection
{
/// A method: its result type, and calls through `Invoke(target, arguments)`.
public final class MethodInfo : MethodBase
{
readonly Type returnType;
internal:
new(Type declaring, str name, i32 flags, TypeDescriber describer, i32 index, Type returnType, ParameterInfo[] parameters) : base(declaring, name, flags, describer, index, parameters)
{
this.returnType = returnType;
}
/// Whether `other` is the same method seen from a class below (an override).
SameAs(MethodInfo other) : bool
{
if (other.Name != Name || other.GetParameters().Length != GetParameters().Length)
return false;
loop (i32 i = 0..GetParameters().Length)
{
if (other.GetParameters()[i].ParameterType != GetParameters()[i].ParameterType)
return false;
}
return true;
}
public:
/// Calls the method on `target` (null for a static method) with `arguments`: its result, boxed (null for none).
Invoke(any? target, any?[] arguments) : any?
{
Check(arguments);
if (IsGenericMethod)
throw new NotSupportedError(Name + " has type parameters: it cannot be called through reflection");
return Describer.Invoke(Index, target, arguments);
}
override ToString() : str => returnType.FullName + " " + Name + "(" + Parameters.Text(GetParameters()) + ")";
Type ReturnType
{
get => returnType;
}
bool IsVirtual
{
get => Has(4);
}
bool IsAbstract
{
get => Has(8);
}
/// A method with its own type parameters (it cannot be called through Invoke).
bool IsGenericMethod
{
get => Has(32);
}
}
}