是否可以在XML文档中包含指向网站的链接?例如,我的方法总结为
///<Summary>
/// This is a math function I found HERE.
///</Summary>
public void SomeMathThing(Double[] doubleArray)
{
...
}
当我输入
SomeMathThing(
我希望IntelliSense显示摘要,并选择单击“此处”链接到外部网站。这可能吗?怎么做?
答案 0 :(得分:106)
尝试:
///<Summary>
/// This is a math function I found <see href="http://stackoverflow.com">HERE</see>
///</Summary>
答案 1 :(得分:59)
炒作有点晚了,但这是我在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);
}
结果是:
答案 2 :(得分:18)
您可以在cref中包含!:前缀,使其在生成的Xml文档中不受影响,以便Innovasys Document! X和Sandcastle等工具可以使用它。 e.g。
/// <summary>
/// This is a math function I found <see cref="!:http://stackoverflow.com">HERE</see>
/// </summary>
Visual Studio intellisense不会将其显示为intellisense的链接 - 因为它是工具提示所以不会有太多意义,因此无论如何都无法点击它。
答案 3 :(得分:14)
您可以使用标准HTML语法:
<a href="http://stackoverflow.com">here</a>
文本将显示在Visual Studio中。
答案 4 :(得分:9)
使用<a>
标签。例如,我在项目中使用了以下解决方案:
结果:
我的XML代码:
/// <summary>
/// This is C# XML Documentation Website Link
/// <a href="https://stackoverflow.com/questions/6960426/c-sharp-xml-documentation-website-link">See more</a>
/// </summary>
或使用<see>
标签。结果与<a>
标签相同。
/// <summary>
/// This is C# XML Documentation Website Link
/// <see href="https://stackoverflow.com/questions/6960426/c-sharp-xml-documentation-website-link">See more</see>
/// </summary>
答案 5 :(得分:1)
我还首先尝试了<see href="https://some.com/>
,但没有成功;但是,我随后尝试了<seealso href="https://some.url/">
,它没有起作用。