如何记录在 C# 中引发一般异常的方法?

How can I document a method which throws a generic exception in C#?

我有一个抛出一般异常的方法,我想记录它,但是我不知道如何写一个有效的 xml 文档。

        /// <summary>
        /// Throws any exception.
        /// </summary>
        /// <typeparam name="TException">Type of the exception to throw </typeparam>
        /// <exception cref="TException"> Thrown when whatever.... </exception>
        public static void Throw<TException>() where TException : Exception
        {
            throw (TException)Activator.CreateInstance(typeof(TException));
        }

上面给出了以下错误:

XML comment has a csref attribute that refers to a type parameter.

最后我想通了:

/// <summary>
/// Throws any exception.
/// </summary>
/// <typeparam name="TException">Type of the exception to throw </typeparam>
/// <exception>Thrown when
///     <cref>TException</cref> whatever...
/// </exception>    
public static void Throw<TException>() where TException : Exception
{
    throw (TException)Activator.CreateInstance(typeof(TException));
}