public static SimpleOperationTarget Build(Expression expression)
        {
            IFastCollection rootFastCollection        = null;
            var             operationTargetExpression = ExpressionNodeReplacer.ReplaceNode(expression, expr =>
            {
                if (expr != null &&
                    expr is FastCollectionReferenceExpression fastCollectionReferenceExpression)
                {
                    if (rootFastCollection != null)
                    {
                        throw new ArgumentException("Multiple fast collections were found in expression tree when build operation target.");
                    }
                    rootFastCollection = fastCollectionReferenceExpression.FastCollection;
                    return(expr);
                }

                return(null);
            });

            if (rootFastCollection == null)
            {
                throw new ArgumentException($"No {nameof(FastCollectionReferenceExpression)} were found in expression tree when build operation target.");
            }
            return(new SimpleOperationTarget(operationTargetExpression, rootFastCollection));
        }
 public void ReplaceTest1()
 {
     Expression <Func <float, float> > expr = x => x * 2 + 3;
     Expression <Func <float, float> > exprReplacedValid = x => x * 8 + 3;
     var exprReplaced = ExpressionNodeReplacer.ReplaceNode(expr, expression =>
     {
         if (expression.NodeType == ExpressionType.Constant &&
             ((ConstantExpression)expression).Value is float val &&
             val == 2)
         {
             return(Expression.Constant(8.0f));
         }
         return(null);
     });