9

Here's an example:

public void DoSomething(String param1, String param2)
{
    if (param1 == null) throw new ArgumentNullException("param1");
    if (param2 == null) throw new ArgumentNullException("param2");
}

2 different reasons for an ArgumentNullException. MSDNs String.Format Example shows 2 different reasons for the FormatException. So, is it done this way:

/// <exception cref="ArgumentNullException">
///     <paramref name="param1"/> is null.
/// </exception>
/// <exception cref="ArgumentNullException">
///     <paramref name="param2"/> is null.
/// </exception>

or some other way?

/// <exception cref="ArgumentNullException">
///     Some other way to show the 2 reasons with an "-or-" between them.
/// </exception>
myermian
  • 31,823
  • 24
  • 123
  • 215

1 Answers1

16

If you think each of the rows of the docs as being one <exception cref=...> </exception>, then logically the correct way to do it is using your second alternative:

/// <exception cref="ArgumentNullException">
///     <p><paramref name="param1"/> is null. </p>
///     <p>- or - </p>
///     <p><paramref name="param2"/> is null. </p>
/// </exception>

You can use 'p' elements to denote the lines.

Miguel Angelo
  • 23,796
  • 16
  • 59
  • 82
  • 2
    I actually ended up using that, but it seemed to be that there should be a better way to do this. Oh well. Also, should be used instead of

    . They're equal, but considering that is recognized by intellisense, I think it's preferred.
    – myermian Jul 18 '11 at 14:13
  • I think that doubling the ``, would be the same as doubling the table rows present in the documentation. For sure, the `para` tag is much better. – Miguel Angelo Jul 18 '11 at 21:44