C #: how to reference standard (T) and constructors in xml comments

I have this class, which you see below in the answer. There I can refer, for example, Valueto <see cref="Value"/>, and the class itself - from <see cref="GenericEventArgs{T}"/>.

  • How can I refer to the default value (T)? Is it possible?
  • How can I refer to constructors?

/// <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; }
}
+3
source share
2 answers

The .net document itself refers to this as: "the default value for the value parameter type."

See Dictionary.TryGetValue documentation

+1
source

, , . JITed , . , "null".

0

Source: https://habr.com/ru/post/1706814/


All Articles