Psst! Did you know DevelopmentNow is a mobile web site design agency?

Contact us for help mobilizing your site, or to sign up for our beta Mobile Web SDK!
all groups > dotnet framework > april 2008 >

dotnet framework : XML Comments and back ticks


Bob Jones
4/28/2008 9:43:40 AM
I am curious. When looking at the XML comments provided by .NET 2.0.
What is the difference between a single and double back tick? MS
documentation http://msdn2.microsoft.com/en-us/library/fsbx0t7x(VS.80).aspx
states;

For generic types, the name of the type will be followed by a back
tick and then a number that indicates the number of generic type
parameters. But they fail to mention the double back tick.


*Samples from mscorlib.xml*

<member name="M:System.Array.AsReadOnly``1(``0[])">

<member
Peter Ritchie [C# MVP]
4/30/2008 12:12:00 PM
I can't seem to find any documentation on it; but it appears with members of
a generic class, a single back-tick signifies a type parameter from the
parent class, and a double back-tick signifies a type parameter from the
method. For example:

public class ClassOne
{
///<summary/>
public void Method<T>(T arg) {/*...*/}
}
would result in an XML file entry like this:
<member name="M:WindowsApplication1.ClassOne.Method``1(``0)">

Whereas
public class ClassTwo<T>
{
///<summary/>
public void Method(T arg) { /*...*/}
}
would result in an XML file entry like this:
<member name="M:WindowsApplication1.ClassOne`1.Method(`0)">

So, you'd be able to decern which parameter type applies to the method and
which to the class in XML with methods like this:
public class ClassOne<T>
{
/// <summary/>
public void Method<T2>(T arg1, T2 arg2) {/*...*/}
}

....which would result in the following XML:
<member name="M:WindowsApplication1.ClassOne`1.Method``1(`0,``0)">

--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#


[quoted text, click to view]
Joey Fontaine
4/30/2008 2:27:27 PM
Peter, thanks for looking into that for me. I was conducting my own
tests and have concluded the following:

Generic types are always defined with a single back tick
Generic methods are always defined with a double back tick

Please correct me if I am not seeign this right.
AddThis Social Bookmark Button