WebMethodAttribute.Description 属性

描述 XML Web services 方法的描述性消息。

**命名空间:**System.Web.Services
**程序集:**System.Web.Services(在 system.web.services.dll 中)

语法

声明
Public Property Description As String
用法
Dim instance As WebMethodAttribute
Dim value As String

value = instance.Description

instance.Description = value
public string Description { get; set; }
public:
property String^ Description {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_Description ()

/** @property */
public void set_Description (String value)
public function get Description () : String

public function set Description (value : String)

属性值

描述 XML Web services 方法的描述性消息。默认值为 String.Empty

备注

当生成 XML Web services 的说明文档(如“服务说明”和“服务帮助”页)时,该描述性消息将向 XML Web services 的预期使用者显示。

示例

在下面的示例中,字符串 Obtains the Server Computer Name 用于描述 XML Web services 的“服务说明和服务”帮助页中的 XML Web services 方法。

<%@ 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
<%@ 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;
    }   
 }

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

WebMethodAttribute 类
WebMethodAttribute 成员
System.Web.Services 命名空间
WebMethodAttribute 类