System.Linq.Expressions.Expression.MakeDynamic C# (CSharp) Метод

MakeDynamic() публичный статический Метод

Creates a DynamicExpression that represents a dynamic operation bound by the provided CallSiteBinder and three arguments.
public static MakeDynamic ( Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2 ) : DynamicExpression
delegateType Type The type of the delegate used by the .
binder CallSiteBinder The runtime binder for the dynamic operation.
arg0 Expression The first argument to the dynamic operation.
arg1 Expression The second argument to the dynamic operation.
arg2 Expression The third argument to the dynamic operation.
Результат DynamicExpression
        public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2)
        {
            ContractUtils.RequiresNotNull(delegateType, nameof(delegateType));
            ContractUtils.RequiresNotNull(binder, nameof(binder));
            if (!delegateType.IsSubclassOf(typeof(MulticastDelegate))) throw Error.TypeMustBeDerivedFromSystemDelegate();

            var method = GetValidMethodForDynamic(delegateType);
            var parameters = method.GetParametersCached();

            ValidateArgumentCount(method, ExpressionType.Dynamic, 4, parameters);
            ValidateDynamicArgument(arg0, nameof(arg0));
            ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1], nameof(delegateType), nameof(arg0));
            ValidateDynamicArgument(arg1, nameof(arg1));
            ValidateOneArgument(method, ExpressionType.Dynamic, arg1, parameters[2], nameof(delegateType), nameof(arg1));
            ValidateDynamicArgument(arg2, nameof(arg2));
            ValidateOneArgument(method, ExpressionType.Dynamic, arg2, parameters[3], nameof(delegateType), nameof(arg2));

            return DynamicExpression.Make(method.GetReturnType(), delegateType, binder, arg0, arg1, arg2);
        }

Same methods

Expression::MakeDynamic ( CallSiteBinder binder, Type returnType, ReadOnlyCollection args ) : DynamicExpression
Expression::MakeDynamic ( Type delegateType, CallSiteBinder binder ) : DynamicExpression
Expression::MakeDynamic ( Type delegateType, CallSiteBinder binder, Expression arg0 ) : DynamicExpression
Expression::MakeDynamic ( Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1 ) : DynamicExpression
Expression::MakeDynamic ( Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3 ) : DynamicExpression
Expression::MakeDynamic ( Type delegateType, CallSiteBinder binder, IEnumerable arguments ) : DynamicExpression

Usage Example

Пример #1
0
 public DynamicExpression Update(IEnumerable <Expression> arguments)
 {
     if (arguments == this.Arguments)
     {
         return(this);
     }
     return(Expression.MakeDynamic(this.DelegateType, this.Binder, arguments));
 }
All Usage Examples Of System.Linq.Expressions.Expression::MakeDynamic
Expression