Browse documentation

Class SymbolExtensions

Namespace
HarmonyLib
Assembly
0Harmony.dll

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

public static class SymbolExtensions
Inheritance
object
SymbolExtensions

Methods

GetFieldInfo(LambdaExpression)

Given a lambda expression that accesses a field, returns the field info

public static FieldInfo GetFieldInfo(LambdaExpression expression)

Parameters

expression LambdaExpression

The lambda expression using the field

Returns

FieldInfo

The field in the lambda expression

GetFieldInfo<T>(Expression<Func<T>>)

Given a lambda expression that accesses a field, returns the field info

public static FieldInfo GetFieldInfo<T>(Expression<Func<T>> expression)

Parameters

expression Expression<Func<T>>

The lambda expression using the field

Returns

FieldInfo

The field in the lambda expression

Type Parameters

T

The generic field type

GetMethodInfo(Expression<Action>)

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

public static MethodInfo GetMethodInfo(Expression<Action> expression)

Parameters

expression Expression<Action>

The lambda expression using the method

Returns

MethodInfo

The method in the lambda expression

GetMethodInfo(LambdaExpression)

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

public static MethodInfo GetMethodInfo(LambdaExpression expression)

Parameters

expression LambdaExpression

The lambda expression using the method

Returns

MethodInfo

The method in the lambda expression

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

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

public static MethodInfo GetMethodInfo<T>(Expression<Action<T>> expression)

Parameters

expression Expression<Action<T>>

The lambda expression using the method

Returns

MethodInfo

The method in the lambda expression

Type Parameters

T

The generic type

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

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

public static MethodInfo GetMethodInfo<T, TResult>(Expression<Func<T, TResult>> expression)

Parameters

expression Expression<Func<T, TResult>>

The lambda expression using the method

Returns

MethodInfo

The method in the lambda expression

Type Parameters

T

The generic type

TResult

The generic result type

Harmony 3 preview

For the stable release, read the 2.x documentation.