Class ExpressionExtensions
- Namespace
- Cratis.Reflection
- Assembly
- Cratis.Fundamentals.dll
Provides methods for working with expressions.
public static class ExpressionExtensions
- Inheritance
-
ExpressionExtensions
- Inherited Members
Properties
Unwrap
A Func to extract a member expression from an Expression.
public static Func<Expression, MemberExpression> Unwrap { get; }
Property Value
Methods
GetFieldInfo(Expression)
Get FieldInfo from an Expression - if any.
public static FieldInfo GetFieldInfo(this Expression expression)
Parameters
expressionExpressionExpression to get FieldInfo from.
Returns
GetInstance(Expression)
Get an instance reference from an Expression - if any.
public static object GetInstance(this Expression expression)
Parameters
expressionExpressionExpression to get an instance from.
Returns
- object
The instance, null if there is none.
GetInstance<T>(Expression)
Get an instance reference from an Expression, with a specific type - if any.
public static T GetInstance<T>(this Expression expression)
Parameters
expressionExpressionExpression to get an instance from.
Returns
- T
The instance, null if there is none.
Type Parameters
TType of the instance.
GetMemberExpression(Expression)
Get MemberExpression from an expression - if any.
public static MemberExpression GetMemberExpression(this Expression expression)
Parameters
expressionExpressionExpression to get MemberExpression from.
Returns
- MemberExpression
MemberExpression instance, null if there is none.
GetMethodArguments(Expression)
Get all argument instances from a method expression.
public static object[] GetMethodArguments(this Expression expression)
Parameters
expressionExpressionExpression to get argument instances from.
Returns
- object[]
Array of argument instances.
GetMethodInfo(Expression)
Get MethodInfo from an expression - if any.
public static MethodInfo GetMethodInfo(this Expression expression)
Parameters
expressionExpressionExpression to get MethodInfo from.
Returns
- MethodInfo
The MethodInfo found, null if did not find one.
GetPropertyInfo(Expression)
Get PropertyInfo from an Expression - if any.
public static PropertyInfo GetPropertyInfo(this Expression expression)
Parameters
expressionExpressionExpression to get PropertyInfo from.
Returns
- PropertyInfo
PropertyInfo instance, null if there is none.