WebMethodAttribute.Description 属性

定义

描述 XML Web 服务方法的描述性消息。

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 服务方法的描述性消息。 默认值为 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 服务的潜在使用者显示描述消息。

适用于

另请参阅