在XML文档中是否可以包含指向网站的链接?例如,我的方法被概括为
///<Summary>
/// This is a math function I found HERE.
///</Summary>
public void SomeMathThing(Double[] doubleArray)
{
...
}
当我输入时
SomeMathThing(
我希望 IntelliSense 能够显示摘要,并提供单击“此处”链接到外部网站的选项。这是否可能?如何实现?
在XML文档中是否可以包含指向网站的链接?例如,我的方法被概括为
///<Summary>
/// This is a math function I found HERE.
///</Summary>
public void SomeMathThing(Double[] doubleArray)
{
...
}
当我输入时
SomeMathThing(
我希望 IntelliSense 能够显示摘要,并提供单击“此处”链接到外部网站的选项。这是否可能?如何实现?
尝试:
///<Summary>
/// This is a math function I found <see href="http://stackoverflow.com">HERE</see>
///</Summary>
https://somewhere.com?test1=1&test2=2
,它就可以工作了。 - paulguy稍微晚了一点,但这是我在研究Visual Studio 2015时发现的内容。
我的示例看起来像这样:
/// <summary>
/// Retrieves information about the specified window.
/// The function also retrieves the value at a specified offset into the extra window memory.
/// From <see cref="!:https://msdn.microsoft.com/en-us/library/windows/desktop/ms633585(v=vs.85).aspx">this</see> MSDN-Link.
/// AHref <a href="http://stackoverflow.com">here</a>.
/// see-href <see href="http://stackoverflow.com">here</see>.
/// </summary>
/// <param name="hwnd"></param>
/// <param name="index"></param>
/// <returns>
/// Testlink in return: <a href="http://stackoverflow.com">here</a>
/// </returns>
public static IntPtr GetWindowLongPtr(IntPtr hwnd, int index)
{
return IntPtr.Size == 4 ? GetWindowLongPtr32(hwnd, index) : GetWindowLongPtr64(hwnd, index);
}
结果如下:
结论:正如Heiner指出的那样,最好的是
See <a href="link">this link</a> for more information.
更新 正如Thomas Hagström指出的那样,Resharper现在支持可点击的a-href URL。相应地更新了截图。
<a href="...">text</a>
,如果您尝试使用<see href="...">text</see>
,将不会显示链接或文本。 - Eric Mutta<a href="http://stackoverflow.com">here</a>
这段文字将在Visual Studio中显示。
您可以在 cref 中添加 !: 前缀,以使其在生成的 Xml 文档中原封不动地传递,从而使诸如 Innovasys Document! X 和 Sandcastle 等工具使用。例如:
/// <summary>
/// This is a math function I found <see cref="!:http://stackoverflow.com">HERE</see>
/// </summary>
尽管如此,Visual Studio Intellisense不会将其显示为链接 - 因为它是一个工具提示,所以无法单击它,这样做也没有太大意义。
<a>
标签。例如,我在我的项目中使用了这个解决方案:
结果:
我的XML代码:/// <summary>
/// This is C# XML Documentation Website Link
/// <a href="https://dev59.com/pWw05IYBdhLWcg3w4125 more</a>
/// </summary>
或者使用<see>
标签。结果与<a>
标签相同。
/// <summary>
/// This is C# XML Documentation Website Link
/// <see href="https://dev59.com/pWw05IYBdhLWcg3w4125 more</see>
/// </summary>
我之前也尝试了<see href="https://some.com/>
,但没有成功;不过后来我尝试了<seealso href="https://some.url/">
,这次成功了。