Class MethodCalls

Namespace
Cratis.Reflection
Assembly
Cratis.Fundamentals.dll

Extension methods for calling methods on objects using reflection.

public static class MethodCalls
Inheritance
MethodCalls
Inherited Members

Methods

CallGenericMethod<TOut, T>(T, Expression<Func<T, Func<TOut>>>, params Type[])

Call generic method.

[RequiresDynamicCode("Uses MakeGenericMethod to invoke generic methods at runtime.")]
public static TOut CallGenericMethod<TOut, T>(this T target, Expression<Func<T, Func<TOut>>> method, params Type[] genericArguments)

Parameters

target T

Target to call method on.

method Expression<Func<T, Func<TOut>>>

Signature of the method.

genericArguments Type[]

Generic arguments.

Returns

TOut

The result from the method call.

Type Parameters

TOut

Output type.

T

Type of target.

CallGenericMethod<TOut, T, T1>(T, Expression<Func<T, Func<T1, TOut>>>, T1, params Type[])

Call generic method.

[RequiresDynamicCode("Uses MakeGenericMethod to invoke generic methods at runtime.")]
public static TOut CallGenericMethod<TOut, T, T1>(this T target, Expression<Func<T, Func<T1, TOut>>> method, T1 param, params Type[] genericArguments)

Parameters

target T

Target to call method on.

method Expression<Func<T, Func<T1, TOut>>>

Signature of the method.

param T1

Method parameter.

genericArguments Type[]

Generic arguments.

Returns

TOut

The result from the method call.

Type Parameters

TOut

Output type.

T

Type of target.

T1

Type of parameter.

CallGenericMethod<TOut, T, T1, T2>(T, Expression<Func<T, Func<T1, T2, TOut>>>, T1, T2, params Type[])

Call generic method.

[RequiresDynamicCode("Uses MakeGenericMethod to invoke generic methods at runtime.")]
public static TOut CallGenericMethod<TOut, T, T1, T2>(this T target, Expression<Func<T, Func<T1, T2, TOut>>> method, T1 param1, T2 param2, params Type[] genericArguments)

Parameters

target T

Target to call method on.

method Expression<Func<T, Func<T1, T2, TOut>>>

Signature of the method.

param1 T1

First parameter.

param2 T2

Second parameter.

genericArguments Type[]

Generic arguments.

Returns

TOut

The result from the method call.

Type Parameters

TOut

Output type.

T

Type of target.

T1

Type of first parameter.

T2

Type of second parameter.

CallGenericMethod<TOut, T, T1, T2, T3>(T, Expression<Func<T, Func<T1, T2, T3, TOut>>>, T1, T2, T3, params Type[])

Call generic method.

[RequiresDynamicCode("Uses MakeGenericMethod to invoke generic methods at runtime.")]
public static TOut CallGenericMethod<TOut, T, T1, T2, T3>(this T target, Expression<Func<T, Func<T1, T2, T3, TOut>>> method, T1 param1, T2 param2, T3 param3, params Type[] genericArguments)

Parameters

target T

Target to call method on.

method Expression<Func<T, Func<T1, T2, T3, TOut>>>

Signature of the method.

param1 T1

First parameter.

param2 T2

Second parameter.

param3 T3

Third parameter.

genericArguments Type[]

Generic arguments.

Returns

TOut

The result from the method call.

Type Parameters

TOut

Output type.

T

Type of target.

T1

Type of first parameter.

T2

Type of second parameter.

T3

Type of third parameter.