C#注释含义(XML注释)标签及其含义(二)

<typeparam>(C# 编程指南)  
<typeparam  name="name">description</typeparam>
参数
name 
类型参数的名称。将此名称用双引号括起来 (" ")。
description 
类型参数的说明。
备注
在泛型类型或方法声明的注释中应该使用 <typeparam> 标记描述类型参数。为泛型类型或方法的每个类型参数添加标记。
有关更多信息,请参见泛型(C# 编程指南)。 
<typeparam> 标记的文本将显示在对象浏览器代码注释 Web 报表 IntelliSense 中。
使用 /doc 进行编译可以将文档注释处理到文件中。
有关显示如何使用 <typeparam> 的代码示例,请参见 <typeparamref>(C# 编程指南)。
<include>(C# 编程指南)  
<include  file=\’filename\’  path=\’tagpath[@name="id"]\’  />
参数
filename 
包含文档的文件名。该文件名可用路径加以限定。将 filename 括在单引号 (\’ \’) 中。
tagpath 
filename 中指向标记 name 的标记路径。将此路径括在单引号中 (\’ \’)。
name 
注释前边的标记中的名称说明符;name 具有一个 id。
id 
位于注释之前的标记的 ID。将此 ID 括在双引号中 (" ")。
备注
<include> 标记使您得以引用描述源代码中类型和成员的另一文件中的注释。这是除了将文档注释直接置于源代码文件中之外的另一种可选方法。
<include> 标记使用 XML XPath 语法。有关自定义 <include> 使用的方法,请参见 XPath 文档。
示例
以下是一个多文件示例。第一个文件使用 <include>,如下所列:
C#

//  compile  with:  /dococFileName.xml  
  
///  <include  file=\’xml_include_tag.doc\’  path=\’MyDocs/MyMembers[@name="test"]/*\’  /> 
class  Test 

     static  void  Main() 
     
     

 
///  <include  file=\’xml_include_tag.doc\’  path=\’MyDocs/MyMembers[@name="test2"]/*\’  /> 
class  Test2 

     public  void  Test() 
     
     

第二个文件 xml_include_tag.doc 包含下列文档注释:

<MyDocs> 
 <MyMembers  name="test"> 
<summary> 
The  summary  for  this  type. 
</summary> 
</MyMembers> 
 <MyMembers  name="test2"> 
<summary> 
The  summary  for  this  other  type. 
</summary> 
</MyMembers> 
 </MyDocs>
程序输出
<?xml version="1.0"?> 
<doc> 
<assembly> 
<name>xml_include_tag</name> 
</assembly> 
<members> 
<member name="T:Test"> 
<summary> 
The summary for this type. 
</summary> 
</member> 
<member name="T:Test2"> 
<summary> 
The summary for this other type. 
</summary> 
</member> 
</members> 
</doc>


<remarks>(C# 编程指南)  
<remarks>description</remarks>
参数
Description 
成员的说明。
备注
<remarks> 标记用于添加有关某个类型的信息,从而补充由 <summary> 所指定的信息。此信息显示在对象浏览器中。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

//  compile  with:  /dococFileName.xml  
  
///  <summary> 
///  You  may  have  some  primary  information  about  this  class. 
///  </summary> 
///  <remarks> 
///  You  may  have  some  additional  information  about  this  class. 
///  </remarks> 
public  class  TestClass 

     ///  text  for  Main
      static  void  Main() 
     
     
}


<typeparamref>(C# 编程指南)  
<typeparamref  name="name"/>
参数
name 
类型参数的名称。将此名称用双引号括起来 (" ")。
备注
有关泛型类型和方法中的类型参数的更多信息,请参见泛型。
使用此标记,文档文件的使用者能够以某种独特的方式设置单词的格式,例如以斜体显示。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

//  compile  with:  /dococFileName.xml  
  
///  comment  for  class 
public  class  TestClass 

     ///  <summary>
      ///  Creates   new  array  of  arbitrary  type  <typeparamref  name="T"/>
      ///  </summary>
      ///  <typeparam  name="T">The  element  type  of  the  array</typeparam>
      public  static  T[]  mkArray<T>(int  n) 
     
         return  new  T[n]; 
     
}


<list>(C# 编程指南)  
<list  type="bullet"   "number"   "table"> 
     <listheader> 
         <term>term</term> 
         <description>description</description> 
     </listheader> 
     <item> 
         <term>term</term> 
         <description>description</description> 
     </item> 
</list>
参数
term 
要定义的项,该项将在 description 中定义。
description 
项目符号列表或编号列表中的项或者 term 的定义。
备注
<listheader> 块用于定义表或定义列表中的标题行。定义表时,只需为标题中的项提供一个项。
列表中的每一项都用一个 <item> 块来描述。创建定义列表时,既需要指定 term 也需要指定 description。但是,对于表、项目符号列表或编号列表,只需为 description 提供一个项。
列表或表所拥有的 <item> 块数可以根据需要而定。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

//  compile  with:  /dococFileName.xml  
  
///  text  for  class  TestClass 
public  class  TestClass 

     ///  <summary>Here  is  an  example  of   bulleted  list:
      ///  <list  type="bullet">
      ///  <item>
      ///  <description>Item  1.</description>
      ///  </item>
      ///  <item>
      ///  <description>Item  2.</description>
      ///  </item>
      ///  </list>
      ///  </summary>
      static  void  Main() 
     
     
}


<returns>(C# 编程指南)  
<returns>description</returns>
参数
description 
返回值的说明。
备注
<returns> 标记应当用于方法声明的注释,以描述返回值。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

//  compile  with:  /dococFileName.xml  
  
///  text  for  class  TestClass 
public  class  TestClass 

     ///  <returns>Returns  zero.</returns>
      public  static  int  GetZero() 
     
         return  0; 
     
      ///  text  for  Main
      static  void  Main() 
     
     
}


<value>(C# 编程指南)  
<value>property-description</value>
参数
property-description 
属性的说明。
备注
<value> 标记使您得以描述属性所代表的值。请注意,当在 Visual Studio .NET 开发环境中通过代码向导添加属性时,它将会为新属性添加 <summary> 标记。然后,应该手动添加 <value> 标记以描述该属性所表示的值。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

//  compile  with:  /dococFileName.xml  
  
///  text  for  class  Employee 
public  class  Employee 

     private  string  _name; 
      ///  <summary>The  Name  property  represents  the  employee\’s  name.</summary>
      ///  <value>The  Name  property  gets/sets  the  _name  data  member.</value>
      public  string  Name 
     
         get
          
             return  _name; 
         
         set
          
             _name   value; 
         
     

 
///  text  for  class  MainClass 
public  class  MainClass 

     ///  text  for  Main
      static  void  Main() 
     
     
}

 
原文地址:https://www.cnblogs.com/greatwang/p/2648250.html