Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="3.2.0-preview-564" />

 ExpressionExtensions

public static class ExpressionExtensions
Holds the Expression extension methods.
public static MemberExpression Access(this PropertyInfo propertyInfo, Expression expression)

Constructs a property access expression, => Expression.Property(expression, prop)

public static BlockExpression AsBlock(this IEnumerable<Expression> expressions, ParameterExpression[] variables)

Constructs a block expression from an expression collection and variables, => Expression.Block(variables, expressions)

public static ConstantExpression AsConstant(this object obj)

Constructs a constant expression from an object, => Expression.Constant(obj)

public static ConstantExpression AsConstant(this object obj, Type type)

Constructs a constant expression from an object and a type, => Expression.Constant(obj, type)

public static DefaultExpression AsDefault(this Type type)

Constructs a default expression from a type, => Expression.Default(type)

public static LambdaExpression AsLambda(this Expression expression, ParameterExpression[] parameters)

Constructs a lambda expression from an expression and parameters, => Expression.Lambda(expression, parameters)

public static LambdaExpression AsLambda(this Expression expression, Type delegateType, IEnumerable<ParameterExpression> parameters)

Constructs a lambda expression from an expression and parameters, => Expression.Lambda(expression, parameters)

public static LambdaExpression AsLambda(this Expression expression, Type delegateType, ParameterExpression[] parameters)

Constructs a lambda expression from an expression and parameters, => Expression.Lambda(expression, parameters)

public static LambdaExpression AsLambda(this Expression expression, IEnumerable<ParameterExpression> parameters)

Constructs a lambda expression from an expression and parameters, => Expression.Lambda(expression, parameters)

public static Expression<TDelegate> AsLambda<TDelegate>(this Expression expression, ParameterExpression[] parameters)

Constructs a lambda expression from an expression and parameters, => Expression.Lambda{TDelegate}(expression, parameters)

public static ParameterExpression AsParameter(this Type type, string name = null)

Constructs a parameter expression from a type, => Expression.Parameter(type, name)

public static BinaryExpression AssignTo(this Expression left, Expression right)

Constructs an assigment expression, => Expression.Assign(left, right)

public static MemberAssignment AssignTo(this MemberInfo memberInfo, Expression expression)

Constructs an assigment expression, => Expression.Bind(member, expression)

public static ParameterExpression AsVariable(this Type type, string name = null)

Constructs a variable expression from a type, => Expression.Variable(type, name)

public static MethodCallExpression CallMethod(this Expression target, MethodInfo methodInfo, Expression[] parameters)

Constructs a method call expression from a target expression, method info and parameters, => Expression.Call(target, methodInfo, parameters)

public static MethodCallExpression CallMethod(this Expression target, MethodInfo methodInfo, IEnumerable<Expression> parameters)

Constructs a method call expression from a target expression, method info and parameters, => Expression.Call(target, methodInfo, parameters)

public static MethodCallExpression CallMethod(this MethodInfo methodInfo, Expression target, Expression[] parameters)

Constructs a method call expression from a target expression, method info and parameters, => Expression.Call(target, methodInfo, parameters)

public static MethodCallExpression CallStaticMethod(this MethodInfo methodInfo, Expression[] parameters)

Constructs a static method call expression from a MethodInfo and its parameters, => Expression.Call(methodInfo, parameters)

public static Func<IResolutionScope, object> CompileDelegate(this Expression expression, ResolutionContext resolutionContext, ContainerConfiguration containerConfiguration)

Compiles an Expression to a Func<T, U> of IResolutionScope, Object.

public static Delegate CompileDelegate(this LambdaExpression expression)

Compiles a LambdaExpression to a Delegate. For testing purposes.

public static Func<IResolutionScope, Delegate> CompileDynamicDelegate(this Expression expression, ResolutionContext resolutionContext, ContainerConfiguration containerConfiguration)

Compiles an Expression to a Func<T, U> of IResolutionScope, Delegate.

public static Func<T> CompileFunc<T>(this Expression<Func<T>> expression)

Compiles a lambda expression into a Func delegate.

public static Func<T1, T> CompileFunc<T1, T>(this Expression<Func<T1, T>> expression)

Compiles a lambda expression into a Func delegate.

public static Expression ConvertTo(this Expression expression, Type type)

Constructs a convert expression, => Expression.Convert(expression, type)

public static MemberInitExpression InitMembers(this Expression expression, IEnumerable<MemberBinding> bindings)

Constructs a member init expression, => Expression.MemberInit(expression, bindings)

public static NewArrayExpression InitNewArray(this Type type, Expression[] initializerExpressions)

Constructs a new array expression, => Expression.NewArrayInit(type, initializerExpressions)

public static NewArrayExpression InitNewArray(this Type type, IEnumerable<Expression> initializerExpressions)

Constructs a new array expression, => Expression.NewArrayInit(type, initializerExpressions)

public static InvocationExpression InvokeDelegate(this Delegate delegate, Expression[] parameters)

Constructs an invocation expression, => Expression.Invoke(delegate.AsConstant(), parameters)

public static InvocationExpression InvokeLambda(this LambdaExpression expression, Expression[] parameters)

Constructs an invocation expression, => Expression.Invoke(expression, parameters)

public static NewExpression MakeNew(this ConstructorInfo constructor, IEnumerable<Expression> arguments)

Constructs an new expression, => Expression.New(constructor, arguments)

public static NewExpression MakeNew(this ConstructorInfo constructor, Expression[] arguments)

Constructs an new expression, => Expression.New(constructor, arguments)

public static MemberExpression Member(this Expression expression, MemberInfo memberInfo)

Constructs a member access expression, => Expression.Property(expression, prop) or Expression.Field(expression, field)

public static MemberExpression Prop(this Expression expression, PropertyInfo propertyInfo)

Constructs a property access expression, => Expression.Property(expression, prop)