Exemplo n.º 1
0
        protected override Expression VisitLambda <T>(Expression <T> node)
        {
            Type changedType = ReflectionX.SubstituteType(typeof(T), from, to);

            if (changedType != null)
            {
                return(Expression.Lambda(changedType, Visit(node.Body),
                                         node.Parameters.Select(p => (ParameterExpression)Visit(p))));
            }

            return(base.VisitLambda <T>(node));
        }
Exemplo n.º 2
0
        protected override Expression VisitParameter(ParameterExpression node)
        {
            Type changedType = ReflectionX.SubstituteType(node.Type, from, to);

            if (changedType != null)
            {
                if (!parameterMappings.ContainsKey(node))
                {
                    parameterMappings.Add(node, Expression.Parameter(changedType, node.Name));
                }
                return(parameterMappings[node]);
            }

            return(base.VisitParameter(node));
        }