/// <inheritdoc />
        public void CopyTo(IVariablesCollection other)
        {
            other.EnsureNotNull(nameof(other));

            foreach (var kvp in this)
            {
                other.SetValue(kvp.Key, kvp.Value);
            }
        }
        /// <summary>Initializez a new instance of an expression evaluator.</summary>
        /// <param name="context">The math context.</param>
        /// <param name="variables">The variables collection.</param>
        public ExpressionEvaluator(IMathContext context, IVariablesCollection variables)
        {
            context.EnsureNotNull(nameof(context));
            variables.EnsureNotNull(nameof(variables));

            _variables = variables;
            _context   = context;

            _expressionEvaluators = new Dictionary <ExpressionType, Func <IExpression, ValueExpression> >
            {
                [ExpressionType.BinaryExpression]   = EvaluateBinaryExpression,
                [ExpressionType.UnaryExpression]    = EvaluateUnaryExpression,
                [ExpressionType.ConstantExpression] = EvaluateConstantExpression,
                [ExpressionType.GroupingExpression] = EvaluateGroupingExpression,
                [ExpressionType.VariableExpression] = EvaluateVariableExpression
            };
        }