2010-11-04 86 views

回答

14

如果你在你的方法(///)上面的行中键入三个斜杠将扩大为XML文档的模板。任何你在summary部分填写将在工具提示中显示出来。

模板应该是这个样子(很简单的例子):

/// <summary> 
/// Always returns 1 
/// </summary> 
private Int32 MyMethod() 
{ 
    return 1; 
} 
2

在立即行上述方法进三个斜杠///和模板会出现自动神奇。输入一些文字并显示。

57

您可以使用XML文档与3个斜杠(///)

/// <summary> 
    /// Description for SomeMethod.</summary> 
    /// <param name="s"> Parameter description for s goes here</param> 
    /// <seealso cref="String"> 
    /// You can use the cref attribute on any tag to reference a type or member 
    /// and the compiler will check that the reference exists. </seealso> 
    public void SomeMethod(string s) 
    { 
    } 

Here你可以找到这种类型的文档有大量的实例教程。

+1

您还必须确保编译选项已打开才能使编译的DLL工作:打开项目属性,选择“Build”选项并选中“XML文档文件”。 – 2010-11-04 08:34:56

+0

为了帮助创建这些评论,请查看“GhostDoc”。 – 2010-11-04 08:45:21

+1

有了这些XML注释,你也可以自动生成API文档使用的工具,如沙堡帮助文件生成器。 – Ian 2010-11-04 09:05:57

0

对于我来说,在下面的方式太(在VS 2008):

void foo 
(int x) 
/* 
Function description here 
*/ 
{ 

} 
1

为了使文档更容易些,你应该看一看GhostDoc

另外,如果你建立了一个程序集并想在别的地方使用它,你应该检查你的项目属性下的构建复选框XML documentation file,并始终注意,这个文件将与你的程序集具有相同的名称,并将保持相同夹。当您仅添加对生成的装配文件的引用时,这些注释也将用于智能感知。

也许this link还提供了一些有用的信息给你。

0
/// <calculate volume> 
    /// 
    /// </volume> 
    /// <lenght lenght="num1"></toconvert> 
    /// <width width="num2"></convert> 
    /// <hight height="num3"></volume> 
    public static void VolBox(int num1, int num2,int num3) 
    { 
     //looks for imput tofind volume of rectangular box 
     int volume; 
     volume = num1 * num2 * num3; 
     Console.WriteLine("the volume of your rectangle box is {0} .",volume); 
    } 
+0

如何评论是你写3 /像(///)这一点, – 2017-08-18 21:44:40

+0

那么你就写卷区域下的体积计算评论 – 2017-08-18 21:45:36

+0

都喜欢/体积或lenght这些名字对你的变量bassed你写underneat它评论。 – 2017-08-18 21:47:08

相关问题