[WebMethod]public int Add(int a, int b){ return(a + b);}[WebMethod]public System.Single Subtract(System.Single A, System.Single B){ return (A - B);}[WebMethod]public System.Single Multiply(System.Single A, System.Single B){ return A * B;}[WebMethod]public System.Single Divide(System.Single A, System.Single B){ if(B == 0) return -1; return Convert.ToSingle(A / B);}
localhost.Service1 myMathService = new localhost.Service1();
Console.Write("2 + 4 = {0}", myMathService.Add(2,4));