由于评论中的cref引用,在C#app中出现模糊的引用错误?

问题描述 投票:2回答:2

这是我以前从未见过的新问题。它发生在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
{
    ...

注意:我为.NET Framework 4.5.1版重新定位了LibCURL.NET。我提到这个可能是相关的。

c# .net comments ambiguous libcurl.net
2个回答
3
投票

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

0
投票

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

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

同样,在你的参数类型涉及泛型的情况下,你将不得不逃避<>字符。就我而言,function(IList<uint>)必须写成function(IList&lt;uint&gt;)

© www.soinside.com 2019 - 2024. All rights reserved.