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
-
objectSymbolExtensions
Methods
GetFieldInfo(LambdaExpression)
Given a lambda expression that accesses a field, returns the field info
public static FieldInfo GetFieldInfo(LambdaExpression expression)
Parameters
expressionLambdaExpressionThe 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
expressionExpression<Func<T>>The lambda expression using the field
Returns
- FieldInfo
The field in the lambda expression
Type Parameters
TThe 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
expressionExpression<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
expressionLambdaExpressionThe 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
expressionExpression<Action<T>>The lambda expression using the method
Returns
- MethodInfo
The method in the lambda expression
Type Parameters
TThe 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
expressionExpression<Func<T, TResult>>The lambda expression using the method
Returns
- MethodInfo
The method in the lambda expression
Type Parameters
TThe generic type
TResultThe generic result type