开发者

Visual Studio 2010 - intellisense in comments

Is it possible to create an intellisense-like link to a 开发者_如何学编程class / class property / class method in a simple comment in Visual Studio 2010 (doing ASP.NET MVC 3 project but i guess that doesn't really matter)? Are there any free plugins for this functionality?

Let's say I have this code:

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

I want to click on [TableModelClass] which will either open new tab or switch to already opened one and scroll automatically to the definition of class/method/etc., as if you typed F12 on it anywhere else outside comments.

I suspect there must be some VS plugins out there in the Internet...been googling for a while...


You can't add a link to another type.method that will actually appear as a clickable link in your code.

However, you can use XML documentation comments to add a link to another type/method that will appear as a clickable link in the Object Browser, in the generated XML documentation file, or in any other documentation that you might generate from these comments using tools like Sandcastle.

The syntax is to use either the <see> or <seealso> tag, and specify the type/method you want to link to as the cref attribute.

For example:

/// <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);
}


Not sure if I understand you correctly, but in Visual Studio 2008/2010 you can use the built-in intellisense by simply using triple slashes ///. Ie:

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

Is this what you are looking for?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜