簡體   English   中英

Visual Studio 2010-注釋中的intellisense

[英]Visual Studio 2010 - intellisense in comments

是否可以在Visual Studio 2010中的簡單注釋中創建類似於智能感知的類/類屬性/類方法的鏈接(做ASP.NET MVC 3項目,但我想那並不重要)? 是否有任何免費插件可用於此功能?

假設我有以下代碼:

//Blahblahblah
//As you can see on its definition - [SomeClass.SomeProperty] - blahblahblah
//blahblahblah
SomeInstanceOfSomeClass.CallingSomethingUsingSomeProperty(42);

我想單擊[TableModelClass],它將打開新選項卡或切換到已經打開的選項卡,並自動滾動到class / method / etc。的定義,就像在注釋之外的其他任何地方鍵入F12一樣。

我懷疑互聯網上肯定有一些VS插件...正在搜索一段時間...

您無法添加指向另一種type.method的鏈接,該鏈接實際上將在代碼中顯示為可點擊的鏈接。

但是,您可以使用XML文檔注釋將鏈接添加到另一個類型/方法,該鏈接將在對象瀏覽器,生成的XML文檔文件或您可能使用工具從這些注釋生成的任何其他文檔中顯示為可單擊的鏈接。就像沙堡一樣。

語法是使用<see><seealso>標記,並將要鏈接的類型/方法指定為cref屬性

例如:

/// <summary>This is a helper method to add two integer values together.
/// <para>
/// <see cref="System.Console.WriteLine(System.Int32)"/> for information
/// about how to display the results.
/// </para>
/// <seealso cref="MyClass.Subtract"/>
/// </summary>
public static int AddIntegers(int a, int b)
{
    return (a + b);
}

不確定我是否理解正確,但是在Visual Studio 2008/2010中,您可以通過簡單地使用三斜杠///來使用內置的智能感知。 即:

/// <summary>
/// My method summary
/// </summary>
/// <param name="myParam">some text</param>
void MyFunction(int myParam)
{}

這是你想要的?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM