Interface IMethodInfo
The IMethodInfo class is used to encapsulate information about a method in a platform-independent manner.
Namespace: NUnit.Framework.Interfaces
Assembly: nunit.framework.dll
Syntax
public interface IMethodInfo : IReflectionInfo
Properties
View SourceContainsGenericParameters
Gets a value indicating whether the method contains unassigned generic type parameters.
Declaration
bool ContainsGenericParameters { get; }
Property Value
Type | Description |
---|---|
bool |
IsAbstract
Gets a value indicating whether the method is abstract.
Declaration
bool IsAbstract { get; }
Property Value
Type | Description |
---|---|
bool |
IsGenericMethod
Gets a value indicating whether the method is a generic method.
Declaration
bool IsGenericMethod { get; }
Property Value
Type | Description |
---|---|
bool |
IsGenericMethodDefinition
Gets a value indicating whether the MethodInfo represents the definition of a generic method.
Declaration
bool IsGenericMethodDefinition { get; }
Property Value
Type | Description |
---|---|
bool |
IsPublic
Gets a value indicating whether the method is public.
Declaration
bool IsPublic { get; }
Property Value
Type | Description |
---|---|
bool |
IsStatic
Gets a value indicating whether the method is static.
Declaration
bool IsStatic { get; }
Property Value
Type | Description |
---|---|
bool |
MethodInfo
Gets the MethodInfo for this method.
Declaration
MethodInfo MethodInfo { get; }
Property Value
Type | Description |
---|---|
MethodInfo |
Name
Gets the name of the method.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
string |
ReturnType
Gets the return Type of the method.
Declaration
ITypeInfo ReturnType { get; }
Property Value
Type | Description |
---|---|
ITypeInfo |
TypeInfo
Gets the Type from which this method was reflected.
Declaration
ITypeInfo TypeInfo { get; }
Property Value
Type | Description |
---|---|
ITypeInfo |
Methods
View SourceGetGenericArguments()
Returns the Type arguments of a generic method or the Type parameters of a generic method definition.
Declaration
Type[] GetGenericArguments()
Returns
Type | Description |
---|---|
Type[] |
GetParameters()
Gets the parameters of the method.
Declaration
IParameterInfo[] GetParameters()
Returns
Type | Description |
---|---|
IParameterInfo[] |
Invoke(object?, params object?[]?)
Invokes the method, converting any TargetInvocationException to an NUnitException.
Declaration
object? Invoke(object? fixture, params object?[]? args)
Parameters
Type | Name | Description |
---|---|---|
object | fixture | The object on which to invoke the method |
object[] | args | The argument list for the method |
Returns
Type | Description |
---|---|
object | The return value from the invoked method |
MakeGenericMethod(params Type[])
Replaces the type parameters of the method with the array of types provided and returns a new IMethodInfo.
Declaration
IMethodInfo MakeGenericMethod(params Type[] typeArguments)
Parameters
Type | Name | Description |
---|---|---|
Type[] | typeArguments | The type arguments to be used |
Returns
Type | Description |
---|---|
IMethodInfo | A new IMethodInfo with the type arguments replaced |