XML documentation on generics
Hi,
I've been searching the MSDN docs, Googling around and trying to search these forums, but yet have to find an answer to my question.
How do you reference a generic class using XML documentation? Obviously, <see cref="System.Collections.Generic.List<T>"/> doesn't work. I tried <see cref="System.Collections.Generic.List`1"/> - as that is how MSIL treats it, but that didn't work either. What is the correct syntax for doing this?
Thanks in advance!
Frederik Carlier
Thanks for the link! Who would've thunk, the curly braces notation is actually a standard C# feature. Here's the relevant paragraph from the "Final Working Draft" (April 2005) for the C# 2.0 specs:
"For code elements that contain code that uses generics, the normal generics syntax, for instance List<T>, cannot be used because it produces invalid XML. Instead, curly braces can be used, such as <see cref=”List{T}”/>, or the normal XML escape syntax < and > for instance as in List<T>.""Members of generic types are refered to as
List{T}.Add(T). The variable T in Add(T) is bound by the type parameter T in List{T}. Similarly, the parameter type T of the generic method Sort{T}(T[]) is bound by the type-parameter T. In general, a generic method in a generic class is refered to as C{S}.F{T}(S, List{T}, U), here the parameter S is bound by the type parameter of the class C{S} and the T in List{T} is bound by the type parameter of the generic method F{T}, the parameter type U is free."