由于注释中的 cref 引用,在 C# 应用程序中出现不明确的引用错误?

Rob*_*ler 7 .net c# comments ambiguous libcurl.net

这是我以前从未见过的新问题。它发生在 LibCURL.NET 的开源包装器中:

http://sourceforge.net/projects/libcurl-net/

我收到了一个模棱两可的参考“警告为错误”,但奇怪的是,它是由于 LibCURL 源文件之一中的 CREF 参考而发生的(见下文)。对于名为 Easy.GetInfo() 的方法确实有几种不同的重载,但我不知道如何解决这个问题,因为有问题的代码不是对 Easy.GetInfo() 的方法调用,实际上它不是代码根本没有,但它是 Enum 注释中的 CREF 元素。有谁知道如何解决这一问题?

/// <summary>
/// This enumeration is used to extract information associated with an
/// <see cref="Easy"/> transfer. Specifically, a member of this
/// enumeration is passed as the first argument to
/// <see cref="Easy.GetInfo"/> specifying the item to retrieve in the
/// second argument, which is a reference to an <c>int</c>, a
/// <c>double</c>, a <c>string</c>, a <c>DateTime</c> or an <c>object</c>.
/// </summary>
public enum CURLINFO
{
    ...
Run Code Online (Sandbox Code Playgroud)

注意:我将 LibCURL.NET 重新定位为 .NET 框架版本 4.5.1。我提到这一点,以防它可能相关。

小智 9

还回答历史:您可以通过指定其参数来引用特定的重载函数。

例如,假设您Easy.GetInfo有一个以 int 作为参数的重载。您可以使用 引用该特定函数<see cref="Easy.GetInfo(int)"/>。可以这么说,这件事似乎o:“打破了参考”。(我没有详细讨论这一点。)

另外,如果您的参数类型涉及泛型,则必须转义<>字符。就我而言,function(IList<uint>)必须写成function(IList&lt;uint&gt;)


Rob*_*ler 8

在 Twitter 上得到了答案,感谢 Peter Foot。这确实是一个晦涩的解​​决方案,所以我将它放在这里供其他人作为社区 Wiki 答案找到。我所要做的就是在 CREF 目标前面加上“o:”,这告诉编译器接受对重载函数的引用。见下文:

    /// <summary>
    /// Pass a <c>bool</c>. If it is <c>true</c>, libcurl will attempt to get
    /// the modification date of the remote document in this operation. This
    /// requires that the remote server sends the time or replies to a time
    /// querying command. The <see cref="o:Easy.GetInfo"/> function with the
    /// <see cref="CURLINFO.CURLINFO_FILETIME"/> argument can be used after a
    /// transfer to extract the received time (if any).
    /// </summary>
Run Code Online (Sandbox Code Playgroud)