Visual Studio 2010 - 评论中的智能感知

发布于 2024-11-26 02:13:10 字数 461 浏览 1 评论 0 原文

是否可以在 Visual Studio 2010 中的简单注释中创建类似于智能感知的类/类属性/类方法的链接(正在执行 ASP.NET MVC 3 项目,但我想这并不重要)?有没有免费的插件可以实现这个功能?

假设我有这样的代码:

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

我想单击 [TableModelClass],它将打开新选项卡或切换到已打开的选项卡并自动滚动到类/方法/等的定义,就像您在其他任何地方键入 F12 一样外界评论。

我怀疑互联网上一定有一些 VS 插件...已经谷歌搜索了一段时间...

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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瀟灑尐姊 2024-12-03 02:13:10

您无法添加指向其他 type.method 的链接,该链接实际上会在代码中显示为可点击的链接。

但是,您可以使用 XML 文档注释 添加指向其他类型的链接/method 将在对象浏览器、生成的 XML 文档文件或您可能使用 沙堡

语法是使用 < /a> 或 标记,并将要链接到的类型/方法指定为 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);
}

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);
}
知足的幸福 2024-12-03 02:13:10

不确定我的理解是否正确,但在 Visual Studio 2008/2010 中,您只需使用三斜杠 /// 即可使用内置智能感知。即:

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

这是您要找的吗?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文