[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

XML Comments and back ticks

Bob Jones

4/28/2008 4:44:00 PM

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/librar...(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)">
2 Answers

Peter Ritchie [C# MVP]

4/30/2008 7:12:00 PM

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)">

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


"Bob Jones" wrote:

> 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/librar...(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)">
>

Bob Jones

4/30/2008 9:27:00 PM

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.