src/NetStandard/Linq/Expressions/Expressions/src/SourceTargetExpressionTools.cs
/// <summary>
/// Reduces parameter list by replacing the expression parameter expression
/// usages (of type <typeparamref name="ComparisonType"/>) with constant 
/// expression crafted from <paramref name="comparisonValue"/>.
/// </summary>
/// <typeparam name="SourceType">The first parameter expression.</typeparam>
/// <typeparam name="ComparisonType">The second parameter expression.</typeparam>
/// <param name="comparisonValue">The value that will be used as constant.</param>
/// <param name="sourceAndValuePredicate">The lambda expression from which the body will be rewritten.</param>
/// <returns>A new lambda with rewritten body.</returns>
Reduces parameter list by replacing the expression parameter expression
usages (of type ) with constant
expression crafted from .
Reduces parameter list by replacing the expression parameter expression usages ( of type ) with constant expression crafted from .
public static Expression<Func<SourceType, bool>> ReplaceParameterByConstantLambda<SourceType>(
            LambdaExpression lambdaWithParameters,
            IReadOnlyDictionary<int, ParameterExpression>? positionalParameterReplacements,
            IReadOnlyDictionary<int, object?> positionalConstants,
            out IReadOnlyList<ParameterExpression> positionalParameters)
        {
            var whereInConstantExpression = ReplaceParameterByConstantLambdaBody(
                lambdaWithParameters, 
                positionalParameterReplacements,
                positionalConstants,
                out positionalParameters);
            var newSourcePredicate = Expression.Lambda<Func<SourceType, bool>>(whereInConstantExpression, positionalParameters);
            return newSourcePredicate;
        }
public static Expression < Func < SourceType , bool > > ReplaceParameterByConstantLambda < SourceType > ( LambdaExpression lambdaWithParameters , IReadOnlyDictionary < int , ParameterExpression > ? positionalParameterReplacements , IReadOnlyDictionary < int , object ? > positionalConstants , out IReadOnlyList < ParameterExpression > positionalParameters ) { var whereInConstantExpression = ReplaceParameterByConstantLambdaBody ( lambdaWithParameters , positionalParameterReplacements , positionalConstants , out positionalParameters ) ; var newSourcePredicate = Expression . Lambda < Func < SourceType , bool > > ( whereInConstantExpression , positionalParameters ) ; return newSourcePredicate ; }
Reduces parameter list by replacing the expression parameter expression
usages (of type ) with constant
expression crafted from .
Reduces parameter list by replacing the expression parameter expression usages ( of type ) with constant expression crafted from .
A new lambda with rewritten body.
A new lambda with rewritten body .
lambdaWithParameters
LambdaExpression
positionalParameterReplacements
IReadOnlyDictionary<int, ParameterExpression>?
positionalConstants
IReadOnlyDictionary<int, object?>
IReadOnlyList<ParameterExpression>
out
comparisonValue
The value that will be used as constant.
The value that will be used as constant .
sourceAndValuePredicate
The lambda expression from which the body will be rewritten.
The lambda expression from which the body will be rewritten .
typeparam
The first parameter expression.
The first parameter expression .
typeparam
The second parameter expression.
The second parameter expression .