自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

詳解C#文檔XML標(biāo)記

開發(fā) 后端
C#文檔XML標(biāo)記的屬性和使用在我們開發(fā)過程中經(jīng)常會(huì)用,那么這里就向你介紹C#文檔XML標(biāo)記的屬性和特點(diǎn)以及應(yīng)用實(shí)例,希望對(duì)你學(xué)習(xí)C#文檔XML標(biāo)記有所幫助。

C#文檔XML標(biāo)記是我們?cè)贑#文檔制作的時(shí)候必須要使用的,那么關(guān)于C#文檔XML標(biāo)記的各種標(biāo)記的屬性是如何的呢?我們使用中會(huì)有什么特點(diǎn)呢?那么讓我們來(lái)具體看看。

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ù)的合法性。如果通不過,會(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)記

  1. /// <summary>  
  2.  
  3. /// A method with a string array param.  
  4.  
  5. /// </summary>  
  6.  
  7. /// <param name="ss"></param>  
  8.  
  9. public void Koo(string[] ss) {}  

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

  1. /// <summary>  
  2.  
  3. /// A nonvoid method.  
  4.  
  5. /// </summary>  
  6.  
  7. /// <returns>The result of the operation.</returns>  
  8.  
  9. public int Noo() { return 0; }  

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

  1. /// <summary>  
  2.  
  3. /// <exception cref="System.Exception">  
  4.  
  5. /// Throws a FileIOException when...  
  6.  
  7. /// </exception>  
  8.  
  9. /// </summary>  
  10.  
  11. public void Foo() {} 

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

  1. /// <summary>  
  2.  
  3. /// <c>Hoo</c> is a method in the <c>Class1</c> class.  
  4.  
  5. /// </summary>  
  6.  
  7. public void Hoo() {}  
  8.  
  9.    
  10.  
  11. /// <summary>  
  12.  
  13. /// The Joo method.  
  14.  
  15. /// <example>This example shows how to use Joo:  
  16.  
  17. /// <code>  
  18.  
  19. /// <newpara/>  
  20.  
  21. /// public static void Main()  
  22.  
  23. /// {  
  24.  
  25. ///     Console.WriteLine(Class1.Joo());  
  26.  
  27. /// }  
  28.  
  29. /// <newpara/>  
  30.  
  31. /// </code>  
  32.  
  33. /// </example>  
  34.  
  35. /// </summary>  
  36.  
  37. public static int Joo() { return 0; }  

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

  1. <include file=''''filename'''' path=''''tagpath[@name="id"]'''' />  
  2.  
  3.    
  4.  
  5. /// <include file=''''supporting.xml'''' path=''''MyDocs/MyMembers[@name="Class1"]/*'''' />  
  6.  
  7. class Class1{  
  8.  
  9. public static void Main() {}  
  10.  
  11. }  
  12.  
  13. supporting.xml  
  14.  
  15. <MyDocs>  
  16.  
  17.     <MyMembers name="Class1">  
  18.  
  19.         <summary>  
  20.  
  21.         The summary for this type.  
  22.  
  23.         </summary>  
  24.  
  25.     </MyMembers>  
  26.  
  27.     <MyMembers name="Class2">  
  28.  
  29.         <summary>  
  30.  
  31.         Another type description.  
  32.  
  33.         </summary>  
  34.  
  35.     </MyMembers>  
  36.  
  37. </MyDocs>  

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

  1. <list type="bullet" │ "number" │ "table">  
  2.  
  3.     <listheader>  
  4.  
  5.         <term>term</term>  
  6.  
  7.         <description>description</description>  
  8.  
  9.     </listheader>  
  10.  
  11.     <item>  
  12.  
  13.         <term>term</term>  
  14.  
  15.         <description>description</description>  
  16.  
  17.     </item>  
  18.  
  19. </list>  
  20.  
  21.    
  22.  
  23. /// <remarks>Here is an example of a bulleted list:  
  24.  
  25. /// <list type="bullet">  
  26.  
  27. /// <item>  
  28.  
  29. /// <description>Item 1.</description>  
  30.  
  31. /// </item>  
  32.  
  33. /// <item>  
  34.  
  35. /// <description>Item 2.</description>  
  36.  
  37. /// </item>  
  38.  
  39. /// </list>  
  40.  
  41. /// </remarks>  
  42.  
  43. static void Main(string[] args) {}  

C#文檔XML標(biāo)記的基本內(nèi)容就向你介紹到這里,希望對(duì)你了解和學(xué)習(xí)C#文檔XML標(biāo)記有所幫助。

【編輯推薦】

  1. C#調(diào)用瀏覽器的原理及實(shí)現(xiàn)淺析
  2. C#文件瀏覽器制作的詳細(xì)過程
  3. C#貨幣格式轉(zhuǎn)化實(shí)例解析
  4. 淺析C#文檔自動(dòng)化實(shí)現(xiàn)
  5. C#文檔輸出的類型描述符淺析

 

責(zé)任編輯:仲衡 來(lái)源: host01.com
相關(guān)推薦

2009-08-18 17:08:50

C#編寫XML文檔

2009-08-24 17:24:28

C#創(chuàng)建XML文檔

2009-08-24 17:46:54

C#創(chuàng)建XML文檔

2009-08-12 15:26:38

C#讀取XML文檔

2009-08-18 17:05:08

C#操作xml文件

2009-08-12 16:26:30

C#讀取XML文檔

2009-08-26 11:32:37

C#打印文檔

2009-09-09 18:20:29

C# XML編程

2009-08-12 16:46:22

C#讀取XML文檔

2009-08-18 16:42:49

C# 操作XML

2009-09-09 13:57:28

C# XML解析

2009-08-19 16:42:41

C#如何使用XML

2009-09-01 09:12:37

C# System.X

2010-09-28 11:03:19

XML DOM

2009-08-18 16:30:41

C# 操作XML

2024-07-03 08:21:56

MDI窗體界面

2009-08-14 17:09:48

C#引用類型

2009-07-30 18:20:21

C#繼承

2009-08-24 11:23:41

C# TimeLabe

2009-09-07 16:13:56

C# MessageB
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)