Example #1
0
        // public methods
        /// <summary>
        /// Replaces all occurences of one parameter with a different parameter.
        /// </summary>
        /// <param name="node">The expression containing the parameter that should be replaced.</param>
        /// <param name="fromParameter">The from parameter.</param>
        /// <param name="toExpression">The expression that replaces the parameter.</param>
        /// <returns>The expression with all occurrences of the parameter replaced.</returns>
        public static Expression ReplaceParameter(Expression node, ParameterExpression fromParameter, Expression toExpression)
        {
            var replacer = new ExpressionParameterReplacer(fromParameter, toExpression);

            return(replacer.Visit(node));
        }
 // public methods
 /// <summary>
 /// Replaces all occurences of one parameter with a different parameter.
 /// </summary>
 /// <param name="node">The expression containing the parameter that should be replaced.</param>
 /// <param name="fromParameter">The from parameter.</param>
 /// <param name="toExpression">The expression that replaces the parameter.</param>
 /// <returns>The expression with all occurrences of the parameter replaced.</returns>
 public static Expression ReplaceParameter(Expression node, ParameterExpression fromParameter, Expression toExpression)
 {
     var replacer = new ExpressionParameterReplacer(fromParameter, toExpression);
     return replacer.Visit(node);
 }