WebMethodAttribute.Description 屬性

定義

描述訊息,描述 XML Web Service 方法。

public:
 property System::String ^ Description { System::String ^ get(); void set(System::String ^ value); };
public string Description { get; set; }
member this.Description : string with get, set
Public Property Description As String

屬性值

描述訊息,描述 XML Web Service 方法。 預設值是 Empty

範例

在下列範例中,字串 Obtains the Server Computer Name 是用來描述 XML Web 服務的 [服務描述和服務說明] 頁面中的 XML Web 服務方法。

<%@ WebService Language="C#" Class="Util" %>
 
 using System;
 using System.Web.Services;
 
 public class Util: WebService {
    [ WebMethod(Description="Obtains the Server Computer Name",
    EnableSession=false)]
    public string GetMachineName() {
       return Server.MachineName;
    }   
 }
<%@ WebService Language="VB" Class="Util" %>

Imports System
Imports System.Web.Services

Public Class Util
    Inherits WebService

    <WebMethod(Description := "Obtains the Server Computer Name", _
        EnableSession := False)> _
    Public Function GetMachineName() As String
        
        Return Server.MachineName
    End Function
End Class

備註

產生 XML Web 服務的描述檔時,XML Web 服務的潛在取用者會顯示描述性訊息,例如服務描述和服務說明頁面。

適用於

另請參閱