Using C#'s XML comment cref attribute with params syntax

Matt H picture Matt H · Apr 17, 2009 · Viewed 14.1k times · Source

In C#, I am trying to use <see cref="blah"/> to reference a method signature that contains the params keyword. I know this converts the parameter list to an array, but I can't even figure out how to refer to an array in a CREF attribute. I am finding nothing in my searches and no one I know has any idea, either. The compiler is choking on the square brackets. I've tried all kinds of different combinations, using curly braces, using the Array class, but nothing is working. Does anyone know this?

Answer

Olivier Dagenais picture Olivier Dagenais · May 6, 2009

According to the B.3.1 ID string format article, referencing an array is done with [square brackets] (with optional lowerbound:size specifiers) but if you just want to refer to an array of a certain type (or even an Object array), you can't just write

<see cref="Object[]"/>

instead you need to specify you're making a type reference with the T: prefix, like

<see cref="T:Object[]"/>

This does not seem to apply when referencing a specific overload of a method, such as

<seealso cref="String.Join(String, String[])"/>