gpt4 book ai didi

c# - 如何从 C# XML 注释中引用构造函数?

转载 作者:IT王子 更新时间:2023-10-29 04:27:52 24 4
gpt4 key购买 nike

是否可以在不借助显式前缀(如 M: 或 T:)的情况下从 C# XML 注释中引用构造函数?

例如,以下会产生编译警告,因为编译器不喜欢“.ctor”。尝试“PublishDynamicComponentAttribute.#ctor”并不好,
“PublishDynamicComponentAttribute.PublishDynamicComponentAttribute”也不行。

/// <summary>
/// Constructs a new <see cref="PublishEntityAttribute"/> instance.
/// </summary>
/// <seealso cref="PublishDynamicComponentAttribute..ctor(Type)"/>
public PublishEntityAttribute(Type entityFactoryType) :
base(entityFactoryType)
{
}

我确定类型本身是可见的。

因此,我只能使用显式前缀 M:,它会删除编译器验证,因此当移动/重命名类型时,cref 将无效。

有什么建议吗?

最佳答案

你像调用它一样指定一个构造函数,但使用参数的类型而不是它们的值:

/// <seealso cref="PublishDynamicComponentAttribute(Type)"/>

关于c# - 如何从 C# XML 注释中引用构造函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1124181/

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