![](/img/trans.png)
[英]How to set JavaScript breakpoints in Visual Studio 2008 or Visual Studio 2010
[英]How to comment a method in Visual Studio 2008/2010
我必须如何在 Visual Studio 中注释方法,以便在我想选择方法时可以在工具提示中看到我的描述?
您使用带有 3 个斜杠 (///) 的 XML 文档
/// <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)
{
}
在这里,您可以找到有关此类文档的教程,其中包含大量示例。
如果您在方法 ( ///
) 上方的行中键入三个斜杠,它将扩展为 XML 文档的模板。 您在summary
部分填写的任何内容都将显示在工具提示中。
模板应该是这样的(非常简单的例子):
/// <summary>
/// Always returns 1
/// </summary>
private Int32 MyMethod()
{
return 1;
}
在方法上方的行中输入三个正斜杠 /// 模板将自动出现。 输入一些文本,它将显示出来。
对我来说,也是以下方式(在 VS 2008 中):
void foo
(int x)
/*
Function description here
*/
{
}
/// <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);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.