gpt4 book ai didi

c# - 覆盖时保留注释

转载 作者:行者123 更新时间:2023-11-30 13:31:24 24 4
gpt4 key购买 nike

有没有一种方法(工具或其他东西)允许在从基类继承/覆盖方法时不重复相同的 XML 注释?

例如:

/// <summary>
/// Represent a brand new object in .NET
/// </summary>
public class MyObject : Object
{
/// <summary>
/// Copy-Paste the same Xml comment
/// like in the base class is boring!
/// </summary>
/// <param name="obj">and params too!! ((</param>
/// <returns>this one too!!! (((</returns>
public override bool Equals(object obj)
{
return base.Equals(obj);
}
}

最佳答案

我认为您正在寻找 inheritdoc:

/// <inheritdoc />
public override bool Equals(object obj)

这不是 standard tag (因此 Intellisense 可能不支持它,例如),但它很常用 - 特别是 Sandcastle supports it .

关于c# - 覆盖时保留注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21759067/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com