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

<c>(C# 编程指南)  
<c>text</c>
参数
text 
希望将其指示为代码的文本。
备注
<c> 标记为您提供了一种将说明中的文本标记为代码的方法。使用 <code> 将多行指示为代码。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

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

     ///  <summary><c>DoWork</c>  is   method  in  the  <c>TestClass</c>  class.
      ///  </summary>
      public  static  void  DoWork(int  Int1) 
     
     
      ///  text  for  Main
      static  void  Main() 
     
     
}


<para>(C# 编程指南)  
<para>content</para>
参数
content 
段落文本。
备注
<para> 标记用于诸如<summary>、<remarks> 或 <returns> 等标记内,使您得以将结构添加到文本中。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
有关使用 <para> 的示例,请参见 <summary>。
<see>(C# 编程指南)  
<see  cref="member"/>
参数
cref "member" 
对可以通过当前编译环境进行调用的成员或字段的引用。编译器检查给定的代码元素是否存在,并将 member 传递给输出 XML 中的元素名称。 应将 member 放在双引号 (" ") 中。
备注
<see> 标记使您得以从文本内指定链接。使用 <seealso> 指示文本应该放在“另请参见”节中。
使用 /doc 进行编译可以将文档注释处理到文件中。
有关使用 <see> 的示例,请参见 <summary>。
示例
下面的示例演示如何对泛型类型进行 cref 引用。
C#

//  compile  with:  /dococFileName.xml  
  
//  the  following  cref  shows  how  to  specify  the  reference,  such  that, 
//  the  compiler  will  resolve  the  reference 
///  <summary  cref="C{T}"> 
///  </summary> 
class    
 
//  the  following  cref  shows  another  way  to  specify  the  reference,   
//  such  that,  the  compiler  will  resolve  the  reference 
//  <summary  cref="C    >">
  
//  the  following  cref  shows  how  to  hard-code  the  reference 
///  <summary  cref="T:C`1"> 
///  </summary> 
class    
 
///  <summary  cref="A"> 
///  </summary> 
///  <typeparam  name="T"></typeparam> 
class  C<T>   }


<code>(C# 编程指南)  
<code>content</code>
参数
content 
希望将其标记为代码的文本。
备注
<code> 标记为您提供了一种将多行指示为代码的方法。使用 <c> 指示应将说明中的文本标记为代码。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
有关如何使用 <code> 标记的示例,请参见 <example> 主题。
<param>(C# 编程指南)  
<param  name=\’name\’>description</param>
参数
name 
方法参数名。将此名称用双引号括起来 (" ")。
description 
参数说明。
备注
<param> 标记应当用于方法声明的注释中,以描述方法的一个参数。
有关 <param> 标记的文本将显示在 IntelliSense、对象浏览器和代码注释 Web 报表中。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

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

     ///  <param  name="Int1">Used  to  indicate  status.</param>
      public  static  void  DoWork(int  Int1) 
     
     
     ///  text  for  Main
      static  void  Main() 
     
     
}


<seealso>(C# 编程指南)  
<seealso  cref="member"/>
参数
cref "member" 
对可以通过当前编译环境进行调用的成员或字段的引用。编译器检查到给定代码元素存在后,将 member 传递给输出 XML 中的元素名。必须将 member 括在双引号 (" ") 中。 
有关如何创建对泛型类型的 cref 引用的信息,请参见 <see>(C# 编程指南)。
备注
<seealso> 标记使您得以指定希望在“请参见”一节中出现的文本。使用 <see> 从文本内指定链接。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
有关使用 <seealso> 的示例,请参见 <summary>。
<example>(C# 编程指南)  
<example>description</example>
参数
description 
代码示例的说明。 
备注
使用 <example> 标记可以指定使用方法或其他库成员的示例。这通常涉及使用 <code> 标记。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

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

     ///  <summary>
      ///  The  GetZero  method.
      ///  </summary>
      ///  <example>  This  sample  shows  how  to  call  the  GetZero  method.
      ///  <code>
      ///  class  TestClass  
      ///  {
      ///      static  int  Main()  
      ///      {
      ///          return  GetZero();
      ///      }
      ///  }
      ///  </code>
      ///  </example>
      public  static  int  GetZero() 
     
         return  0; 
     
      ///  text  for  Main
      static  void  Main() 
     
     
}


<paramref>(C# 编程指南)  
<paramref  name="name"/>
参数
name 
要引用的参数名。将此名称用双引号括起来 (" ")。
备注
<paramref> 标记提供了指示代码注释中的某个单词(例如在 <summary> 或 <remarks> 块中)引用某个参数的方式。可以处理 XML 文件来以不同的方式格式化此单词,比如将其设置为粗体或斜体。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

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

     ///  <summary>DoWork  is   method  in  the  TestClass  class.   
      ///  The  <paramref  name="Int1"/>  parameter  takes   number.
      ///  </summary>
      public  static  void  DoWork(int  Int1) 
     
     
      ///  text  for  Main
      static  void  Main() 
     
     
}


<summary>(C# 编程指南)  
<summary>description</summary>
参数
description 
对象的摘要。
备注
<summary> 标记应当用于描述类型或类型成员。使用 <remarks> 添加针对某个类型说明的补充信息。
<summary> 标记的文本是唯一有关 IntelliSense 中的类型的信息源,它也显示在对象浏览器中。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

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

     ///  <summary>DoWork  is   method  in  the  TestClass  class.
      ///  <para>Here\’s  how  you  could  make   second  paragraph  in   description.  <see  cref="System.Console.WriteLine(System.String)"/>  for  information  about  output  statements.</para>
      ///  <seealso  cref="TestClass.Main"/>
      ///  </summary>
      public  static  void  DoWork(int  Int1) 
     
     
      ///  text  for  Main
      static  void  Main() 
     
     
}


<exception>(C# 编程指南)  
<exception  cref="member">description</exception>
参数
cref "member" 
对可从当前编译环境中获取的异常的引用。编译器检查到给定异常存在后,将 member 转换为输出 XML 中的规范化元素名。必须将 member 括在双引号 (" ") 中。
有关如何创建对泛型类型的 cref 引用的更多信息,请参见 <see>(C# 编程指南)。
description 
异常的说明。
备注
<exception> 标记使您可以指定哪些异常可被引发。此标记可用在方法、属性、事件和索引器的定义中。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

//  compile  with:  /dococFileName.xml  
  
///  comment  for  class 
public  class  EClass   System.Exception 

     //  class  definition...
 
 
///  <exception  cref="System.Exception">Thrown  when...</exception> 
class  TestClass 

     static  void  Main() 
     
         try
          
         
         catch  (EClass) 
         
         
     
}


<permission>(C# 编程指南)  
<permission  cref="member">description</permission>
参数
cref "member" 
对可以通过当前编译环境进行调用的成员或字段的引用。编译器检查到给定代码元素存在后,将 member 转换为输出 XML 中的规范化元素名。必须将 member 括在双引号 (" ") 中。
有关如何创建对泛型类型的 cref 引用的信息,请参见 <see>(C# 编程指南)。
description 
对成员的访问的说明。
备注
<permission> 标记使您得以将成员的访问记入文档。使用 PermissionSet 类可以指定对成员的访问。
使用 /doc 进行编译可以将文档注释处理到文件中。
示例
C#

//  compile  with:  /dococFileName.xml  
  
class  TestClass 

     ///  <permission  cref="System.Security.PermissionSet">Everyone  can  access  this  method.</permission>
      public  static  void  Test() 
     
     
      static  void  Main() 
     
     
}

 
posted @ 2011-11-09 11:02  great wang  阅读(1148)  评论(0编辑  收藏  举报