[英]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.