ExpressionExtensions
Namespace: SnowBank.Runtime · class
Methods
BoxToObject
static Expression BoxToObject(Expression expr)
Boxes an expression to object: '(object) expr'
If the expression's type is a ValueType, then it will be boxed automatically.
CastFromObject
static Expression CastFromObject(Expression expr, Type targetType)
Casts an expression of type 'object' to an instance of type targetType: '(TYPE) obj'
Generates the appropriate expression depending on whether is a ValueType or not. WARNING: in the case of a boxed valuetype/struct, we will return a COPY of the value. If the caller wants to modify it, it will therefore not modify the original!
GetDebugView
static string GetDebugView(Expression expr)
Returns the value of the private DebugView property of an Expression
IsNotNull
static Expression IsNotNull(Expression expr)
Returns an expression '(expr != null)'
IsNull
static Expression IsNull(Expression expr)
Returns an expression '(expr == null)'
PropertyOrField
static Expression PropertyOrField(Expression expr, MemberInfo info)
Returns an expression 'expr.MEMBER' adapted according to the member's type (field, property, ...)