溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

C#文檔XML標(biāo)記有哪些

發(fā)布時(shí)間:2021-12-01 11:44:14 來(lái)源:億速云 閱讀:139 作者:iii 欄目:編程語(yǔ)言

本篇內(nèi)容介紹了“C#文檔XML標(biāo)記有哪些”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

C#文檔XML標(biāo)記的介紹

<c>:指示這行注釋標(biāo)識(shí)為Code

<code>:指示多行注釋標(biāo)識(shí)為Code

<example>:經(jīng)常與<code>連用,用來(lái)給出如何使用某些成員的例子。

<exception>:指明一個(gè)成員會(huì)拋出哪些異常,經(jīng)常與cref屬性連用。

<include>:指明注釋在哪些文件中,以及位置。

<list>:用來(lái)定義表頭,經(jīng)常與<item>連用

<newpara>:內(nèi)部使用,如<remarks>或<returns>。讓用戶有機(jī)會(huì)給注釋文本加入其他的結(jié)構(gòu)。

<param>:說(shuō)明參數(shù)的屬性,編譯器會(huì)檢查參數(shù)的合法性。如果通不過(guò),會(huì)在文檔中產(chǎn)生!標(biāo)識(shí)的警告。

<paramref>:類似<param>。

<permission>:標(biāo)明用于成員的代碼存取的安全性。

<remarks>:用于描述class或其它類型的描述性文字,不涉及具體細(xì)節(jié)(如果是這樣,使用<summary>)。

<returns>:描述方法或函數(shù)的返回值。

<see>:指定一個(gè)鏈接。

<seealso>:指定要出現(xiàn)在See Also部分的文本。

<summary>:類型的描述性文字。它會(huì)被vs.net內(nèi)置的IntelliSense使用并顯示在對(duì)應(yīng)的類型中。(即在vs.net中擊鍵“.”出現(xiàn)的提示)

<value>:描述屬性。

標(biāo)記及描述

cref:可用于任何標(biāo)記來(lái)提供一個(gè)代碼元素的參考。編譯器將檢查這個(gè)代碼元素是否存在,如不存在則在文檔中用!標(biāo)識(shí)。

name:用于<param>或<paramref>

C#文檔XML標(biāo)記使用的例子

1.<param>標(biāo)記

/// <summary>   /// A method with a string array param.   /// </summary>   /// <param name="ss"></param>   public void Koo(string[] ss) {}

2.<returns>標(biāo)記

/// <summary>   /// A nonvoid method.   /// </summary>   /// <returns>The result of the operation.</returns>   public int Noo() { return 0; }

3.<exception>標(biāo)記和cref 屬性:

/// <summary>   /// <exception cref="System.Exception">   /// Throws a FileIOException when...   /// </exception>   /// </summary>   public void Foo() {}

4.<c>, <code>, 和<example>標(biāo)記

/// <summary>   /// <c>Hoo</c> is a method in the <c>Class1</c> class.   /// </summary>   public void Hoo() {}       /// <summary>   /// The Joo method.   /// <example>This example shows how to use Joo:   /// <code>   /// <newpara/>   /// public static void Main()   /// {   ///     Console.WriteLine(Class1.Joo());   /// }   /// <newpara/>   /// </code>   /// </example>   /// </summary>   public static int Joo() { return 0; }

5.<include> 標(biāo)記語(yǔ)法:

<include file=''''filename'''' path=''''tagpath[@name="id"]'''' />       /// <include file=''''supporting.xml'''' path=''''MyDocs/MyMembers[@name="Class1"]/*'''' />   class Class1{   public static void Main() {}   }   supporting.xml   <MyDocs>       <MyMembers name="Class1">           <summary>           The summary for this type.           </summary>       </MyMembers>       <MyMembers name="Class2">           <summary>           Another type description.           </summary>       </MyMembers>   </MyDocs>

6.<list>標(biāo)記語(yǔ)法及應(yīng)用

<list type="bullet" │ "number" │ "table">       <listheader>           <term>term</term>           <description>description</description>       </listheader>       <item>           <term>term</term>           <description>description</description>       </item>   </list>       /// <remarks>Here is an example of a bulleted list:   /// <list type="bullet">   /// <item>   /// <description>Item 1.</description>   /// </item>   /// <item>   /// <description>Item 2.</description>   /// </item>   /// </list>   /// </remarks>   static void Main(string[] args) {}

“C#文檔XML標(biāo)記有哪些”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

xml
AI