Experimenta isso
Java
Double.parseDouble(x) Integer.parseInt(x)
C#
Convert.ToDouble(x) Convert.ToInt32(x)