[英]C#: How to refer to default(T) and constructors in xml comments
我在下面的答案中看到了这门课程。 在那里,我可以参考例如Value
与<see cref="Value"/>
和类本身具有<see cref="GenericEventArgs{T}"/>
/// <summary>
/// A simple <see cref="EventArgs"/> class that can contain a value.
/// </summary>
/// <typeparam name="T">Type of <see cref="Value"/>.</typeparam>
public class GenericEventArgs<T> : EventArgs
{
/// <summary>
/// Instantiates a <see cref="GenericEventArgs{T}"/> with
/// <see cref="default"/> default as Value.
/// </summary>
public GenericEventArgs()
: this(default(T)) {}
/// <summary>
/// Instantiates a <see cref="GenericEventArgs{T}"/>
/// </summary>
/// <param name="value"></param>
public GenericEventArgs(T value)
{
Value = value;
}
/// <summary>
/// The value.
/// </summary>
public T Value { get; private set; }
}
.net文档本身将其称为:“值参数类型的默认值”。
请参阅Dictionary.TryGetValue的文档
不,我认为这是不可能的。 由于类在运行时使用正确的类型进行JIT,因此文档与所使用的实际类型无关。 如果使用类约束,则可以使用“null”替换default。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.