Skip to content

IMethodInvocation

NexusLabs.Needlr

NexusLabs.Needlr

IMethodInvocation Interface

Represents a method invocation that is being intercepted. Provides access to the target instance, method metadata, and arguments.

public interface IMethodInvocation

Derived
MethodInvocation

Properties

IMethodInvocation.Arguments Property

Gets the arguments passed to the method. The array can be modified to change argument values before calling ProceedAsync().

object?[] Arguments { get; }

Property Value

System.Object[]

IMethodInvocation.GenericArguments Property

Gets the generic type arguments if the method is a generic method. Returns an empty array for non-generic methods.

System.Type[] GenericArguments { get; }

Property Value

System.Type[]

IMethodInvocation.Method Property

Gets metadata about the method being invoked.

System.Reflection.MethodInfo Method { get; }

Property Value

System.Reflection.MethodInfo

IMethodInvocation.Target Property

Gets the target service instance on which the method is being invoked.

object Target { get; }

Property Value

System.Object

Methods

IMethodInvocation.ProceedAsync() Method

Proceeds to the next interceptor in the chain, or to the actual method implementation if this is the last interceptor.

System.Threading.Tasks.ValueTask<object?> ProceedAsync();

Returns

System.Threading.Tasks.ValueTask<System.Object>
The result of the method (or the result from the next interceptor). Returns null for void methods.