XML Comments and back ticks

  • Thread starter Thread starter Bob Jones
  • Start date Start date
B

Bob Jones

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
name="M:System.Collections.ObjectModel.KeyedCollection`2.ChangeItemKey(`1,`0)">
 
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)">
 
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.
 
Back
Top