final class · System.Reflection
MethodInfo
public final class MethodInfo : MethodBase
A method: its result type, and calls through Invoke(target, arguments).
- Tipo
- final class
- Espacio de nombres
- System.Reflection
- Ensamblado
- System.Core
- Acceso
- public, final
- Archivo fuente
Reflection.ant
Herencia
- Clases base
-
AnyMemberInfoMethodBaseMethodInfo
Propiedades
A method with its own type parameters (it cannot be called through Invoke).
Métodos
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
#
Miembros privados e internos (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).
Miembros heredados (12)
GetParametersmétodo de MethodBaseGetCustomAttributesmétodo de MemberInfoGetCustomAttributesmétodo de MemberInfoIsDefinedmétodo de MemberInfoNamepropiedad de MemberInfoDeclaringTypepropiedad de MemberInfoIsPublicpropiedad de MemberInfoIsStaticpropiedad de MemberInfoGetTypemétodo de AnyUndescribedmétodo de AnyHashmétodo de Anydestroymétodo de Any
Código fuente
MethodInfo en Antril, descompilado a partir de su 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);
}
}
}