如何使VS 2008中的Xml注释与Intellisense一起使用以进行枚举?

时间:2010-02-11 22:36:40

标签: visual-studio-2008 intellisense xml-comments

似乎并非所有的Xml-Commenting都出现在Intellisense中,但也许我没有正确地做到这一点?无论如何,我试图使枚举列表中的各个枚举成员在intellisense中显示描述性文本。例如,在String.Split方法中,第三个重载将StringSplitOptions枚举作为参数,如下所示:

alt text http://www.freeimagehosting.net/uploads/a138d36615.jpg

我尝试过的其他事情:

public enum ErrorTypeEnum
{
   /// <summary>The process could not identify an agency </summary>
   BatchAgencyIdentification       // Couldn't identify agency
   /// <summary>The batch document category was invalid.</summary>
   , BatchInvalidBatDocCatCode     // Anything other than "C"
   /// <summary>The batch has no documents.</summary>
   , BatchHasNoDocuments           // No document nodes
...

上面的示例可以工作,但仅适用于第一次枚举,而不是任何其他枚举。

我做错了什么?

1 个答案:

答案 0 :(得分:3)

你有正确的想法,但你的逗号位置搞砸了。要显示单个枚举,请将它们放在逗号之后,而不是之前。在这些情况下,您可能希望将逗号放在每行的末尾而不是开头。

e.g。

public enum ErrorTypeEnum 
{ 
   /// <summary>The process could not identify an agency </summary> 
   BatchAgencyIdentification,       // Couldn't identify agency 
   /// <summary>The batch document category was invalid.</summary> 
   BatchInvalidBatDocCatCode,     // Anything other than "C" 
   /// <summary>The batch has no documents.</summary> 
   BatchHasNoDocuments           // No document nodes 
...