代码之家  ›  专栏  ›  技术社区  ›  Gil Sand

我可以在方法声明之外使用<see cref>吗

  •  0
  • Gil Sand  · 技术社区  · 6 年前

    ///<see cref=""> 在函数内部的注释中,并且我只能在方法声明中使其工作。

    我想达到的目标有可能吗?如果是,怎么做?

    所以本质上我需要这个:

    ///<summary>
    ///this is a summary where i can use the <see cref=""> with ease
    ///</summary>
    internal virtual void OnClick()
    {
        if (player.IsPlaying || player.IsBuffering)
        {
            //Some lengthly comment about code that I erased for simplicity
            //And I would like to add a <see cref=""> somewhere around here.
            player.Stop(false);
        }
    
            item.TogglePlayStop();
        }
    }
    

    如果我把它放在方法里,我会 XML Comment is not placed on a valid language element

    我想这样做是因为我在注释中解释的内容与方法无关,只与代码的一小部分相关。我正在开发遗留代码,不得不添加一些有异味的东西。我不希望人们错误地删除它,我当然也不希望人们在上面浪费时间。这很简单,一旦你看到整个图片,我只是想添加一个链接,所以人们不必复制粘贴类名来导航,他们只需点击我的评论(这是7行长)

    0 回复  |  直到 6 年前