XML注释-如何注释出现异常的多种原因?

| 这是一个例子:
public void DoSomething(String param1, String param2)
{
    if (param1 == null) throw new ArgumentNullException(\"param1\");
    if (param2 == null) throw new ArgumentNullException(\"param2\");
}
引发ArgumentNullException的2个不同原因。 MSDN的String.Format示例显示了导致“ 1”的两个不同原因。那么,是否通过这种方式完成:
/// <exception cref=\"ArgumentNullException\">
///     <paramref name=\"param1\"/> is null.
/// </exception>
/// <exception cref=\"ArgumentNullException\">
///     <paramref name=\"param2\"/> is null.
/// </exception>
或其他方式?
/// <exception cref=\"ArgumentNullException\">
///     Some other way to show the 2 reasons with an \"-or-\" between them.
/// </exception>
    
已邀请:
        如果您认为文档的每一行都是一个“ 4”,那么逻辑上正确的方法是使用第二种方法:
/// <exception cref=\"ArgumentNullException\">
///     <p><paramref name=\"param1\"/> is null. </p>
///     <p>- or - </p>
///     <p><paramref name=\"param2\"/> is null. </p>
/// </exception>
您可以使用\'p \'元素表示行。     

要回复问题请先登录注册