Convert Java to C#

I’m trying to convert this Java code (Evaluates arithmetic expressions using Dijkstra’s two-stack algorithm) to C# :

using System;
using System.Collections.Generic;
using System.IO;

public class Evaluate
{
    public double Eval(string expression)
    {
        Stack<string> ops = new Stack<string>();
        Stack<double> vals = new Stack<double>();

        string s = expression;
        while (!s.Equals(""))
        {
            if (s.Equals("(")) ;
            if (s.Equals("+")) ops.Push(s);
            else if (s.Equals("-")) ops.Push(s);
            else if (s.Equals("*")) ops.Push(s);
            else if (s.Equals("/")) ops.Push(s);
            else if (s.Equals("sqrt")) ops.Push(s);
            else if (s.Equals(")"))
            {
                string op = ops.Pop();
                double v = vals.Pop();
                if (op.Equals("+")) v = vals.Pop() + v;
                else if (op.Equals("-")) v = vals.Pop() - v;
                else if (op.Equals("*")) v = vals.Pop() * v;
                else if (op.Equals("/")) v = vals.Pop() / v;
                else if (op.Equals("sqrt")) v = Math.Sqrt(v);
                vals.Push(v);
            }
            else vals.Push(double.Parse(s));
        }
        return vals.Pop();
    }
}

But Unity stop working when I’m try to test it. What have I done wrong? (I’m note that Java not a javascript)

You are looping on the condition that “s” is not empty on line 13. The value of “s” does not change in the body of your loop, thus you will loop forever (which will effectively hang Unity, like you are seeing).
The Java example you provide is reading in an entire String from StdIn and processing that whole string as one argument in the loop (e.g. the Java code has tokenized the input so each read gives a full operator). Your code does not do this.
For this to work (my recommendation) you will need to break up your expression input into tokens prior to processing. It would probably make sense to break up the expression into tokens using a space as the delimiter (see msdn for an example). Then your while loop should go over each token and process it.
Pseudocode:

func Eval expression:str
     tokens = splitStringOnSpaces(expression)
     for each token in tokens
          switch(token)
               case "(" .....do processing.....
               case "+" .....etc
               .....etc
     Next Token
     output result of processing
end func