<%@ webservice language=”vb” class=”convertmoney” %> imports system.web.services <webservice()>public class convertmoney inherits webservice ‘ code will go here end class 現在就可以給你的類添加功能了。在這里,你創建了一個簡單函數接受英鎊的貨幣量然后返回美元值。通常,你還應該在數據庫內找到兩種貨幣之間的交換匯率。在上面的例子里,你在代碼中直接把匯率設定為1英鎊可兌換1.44美元。在以上代碼塊中增加代碼之后全部web服務代碼如下所示。 <%@ webservice language=”vb” class=”convertmoney” %> imports system.web.services <webservice()>public class convertmoney inherits webservice <webmethod()>public function _ poundstodollars(britishpounds as double) as double return britishpounds * 1.44 end function end class