我有这门课,你在下面的答案中看到。在那里我可以参考例如Value
with<see cref="Value"/>
和类本身 with <see cref="GenericEventArgs{T}"/>
。
- 我如何引用默认值(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; }
}