service.cs

来自「Visual C#2005程序设计教程」· CS 代码 · 共 40 行

CS
40
字号
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    public Service () {

        //如果使用设计的组件,请取消注释以下行 
        //InitializeComponent(); 
    }

    [WebMethod]
    
    public float Add(float a,float b)// 完成加运算的方法
    {
        return a + b;
    }
    [WebMethod]
    public float  Subtract(float a, float b)// 完成减运算的方法
    {
        return a - b;
    }
    [WebMethod]
    public float  Multiply(float a, float b)// 完成乘运算的方法
    {
        return a * b;
    }
    [WebMethod]
    public float Divide(float a, float b)// 完成除运算的方法
    {
        return  a / b;
    }

    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?