calculate.cs
来自「《ajax编程技术与实例》的所有的案例」· CS 代码 · 共 43 行
CS
43 行
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
/// <summary>
/// Summary description for Calculate
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Calculate : System.Web.Services.WebService {
public Calculate () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string Count(String left, String right) {
string input1 = Server.HtmlEncode(left);
string input2 = Server.HtmlDecode(right);
if (!String.IsNullOrEmpty(input1) && !String.IsNullOrEmpty(input2))
{
int temp1 = Int32.Parse(input1);
int temp2 = Int32.Parse(input2);
temp1 += temp2;
return "" + temp1;
}
else
{
return "The query string was null or empty";
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?