ARCed.Forms.CalculatorForm.CalculateFunction C# (CSharp) Method

CalculateFunction() private method

private CalculateFunction ( ) : void
return void
        private void CalculateFunction()
        {
            double var1, var2, var3;
            this.number2 = this.InputValue;
            switch (this.function)
            {
                case "+":
                    this.result = this.number1 + this.number2;
                    break;
                case "-":
                    this.result = this.number1 - this.number2;
                    break;
                case "*":
                    this.result = this.number1 * this.number2;
                    break;
                case "/":
                    if (this.number2 == 0)
                    {
                        this.textBox.Text = "ERROR";
                        return;
                    }
                    this.result = this.number1 / this.number2;
                    break;
                case "x^y":
                    this.result = Math.Pow(this.number1, this.number2);
                    break;
                case "%":
                    this.result = this.number1 % this.number2;
                    break;
                case "nPr":
                    var1 = Factorial((int)this.number1);
                    var2 = Factorial((int)(this.number1 - this.number2));
                    this.result = var1 / var2;
                    break;
                case "nCr":
                    var1 = Factorial((int)this.number1);
                    var2 = Factorial((int)(this.number1 - this.number2));
                    var3 = Factorial((int)this.number2);
                    this.result = var1 / (var3 * var2);
                    break;
            }
            this.textBox.Text = Convert.ToString(this.result);
        }