Back to Harmony

Class SymbolExtensions

docs/api/HarmonyLib.SymbolExtensions.html

2.4.2.02.6 KB
Original Source

Class SymbolExtensions

A helper class to retrieve reflection info for non-private methods

Inheritance

System.Object

SymbolExtensions

Namespace : HarmonyLib
Assembly : 0Harmony.dll
Syntax
public static class SymbolExtensions

Methods

GetMethodInfo(Expression<Action>)

Given a lambda expression that calls a method, returns the method info

Declaration
public static MethodInfo GetMethodInfo(Expression<Action> expression)
Parameters
TypeNameDescription
System.Linq.Expressions.Expression\expression

The lambda expression using the method

|

Returns
TypeDescription
System.Reflection.MethodInfo

The method in the lambda expression

|

GetMethodInfo(LambdaExpression)

Given a lambda expression that calls a method, returns the method info

Declaration
public static MethodInfo GetMethodInfo(LambdaExpression expression)
Parameters
TypeNameDescription
System.Linq.Expressions.LambdaExpressionexpression

The lambda expression using the method

|

Returns
TypeDescription
System.Reflection.MethodInfo

The method in the lambda expression

|

GetMethodInfo<T>(Expression<Action<T>>)

Given a lambda expression that calls a method, returns the method info

Declaration
public static MethodInfo GetMethodInfo<T>(Expression<Action<T>> expression)
Parameters
TypeNameDescription
System.Linq.Expressions.Expression\>expression

The lambda expression using the method

|

Returns
TypeDescription
System.Reflection.MethodInfo

The method in the lambda expression

|

Type Parameters
NameDescription
T

The generic type

|

GetMethodInfo<T, TResult>(Expression<Func<T, TResult>>)

Given a lambda expression that calls a method, returns the method info

Declaration
public static MethodInfo GetMethodInfo<T, TResult>(Expression<Func<T, TResult>> expression)
Parameters
TypeNameDescription
System.Linq.Expressions.Expression\>expression

The lambda expression using the method

|

Returns
TypeDescription
System.Reflection.MethodInfo

The method in the lambda expression

|

Type Parameters
NameDescription
T

The generic type

| | TResult |

The generic result type

|