fibonaccisoap.asmx

来自「东软内部材料(四)asp等相关的教学案例 」· ASMX 代码 · 共 30 行

ASMX
30
字号
<%@ WebService Language="C#" class="Fibonacci"%>

using System.Web.Services;
using System.Web.Services.Protocols;

public class SimpleSoapHeader : SoapHeader
{ 
  public string value;
}

public class Fibonacci
{
  public SimpleSoapHeader simpleHeader;

  [WebMethod, SoapHeader("simpleHeader")]
  public int GetSeqNumber(int fibIndex){

    if (fibIndex < 2)
      return fibIndex;

    int[] FibArray = {0,1};

    for (int i = 1; i< fibIndex; i++){
      FibArray[1] = FibArray[0] + FibArray[1];
      FibArray[0] = FibArray[1] - FibArray[0];
    }

    return FibArray[1];
  }
}

⌨️ 快捷键说明

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