In order to reference a member of a class in XML comments/documentation, you have to use the following tag:
<see cref="member"/>
It is better explained here.
How do you reference an indexer?
I mean, a member like this one:
internal object this[ int index ] {
...
}
Thanks in advance.
An indexer is a special type of property that allows a class or a structure to be accessed like an array for its internal collection. C# allows us to define custom indexers, generic indexers, and also overload indexers. An indexer can be defined the same way as property with this keyword and square brackets [] .
The this keyword is used to define the indexer. The value keyword is used to define the value being assigned by the set accessor.
Like a class, Interface can have methods, properties, events, and indexers as its members.
In C#, we can have multiple indexers in a single class. To overload an indexer, declare it with multiple parameters and each parameter should have a different data type. Indexers are overloaded by passing 2 different types of parameters. It is quite similar to method overloading.
I've had the same question, but with a generic Dictionary.Item(TKey) property. The answer by leppie
<see cref="P:System.Collections.ArrayList.Item(System.Int32)" />
and the additional link by ICR (unfortunately I cannot find the "mscorlib.xml")
MSDN: Processing the XML File (C# Programming Guide)
helped me out.
But the answer by user492238
(I know, I should directly comment his answer. But since I am new and this is my first post, please go easy on me, because I am not allowed to comment due to my low reputation.)
<seealso cref="M:My.Namespace.Class1.Get{T}(System.String)"/>
<seealso cref="M:My.Namespace.Class1.Get<T>(System.String)"/>
resulted only in plain, black text, whereby only the seconds shows tag signs <> as given "hard-coded".
I found the solution on the MSDN page to use backticks (`) for generics and got a full ("colory") references to the class and property within my XMLDoc:
<see cref="P:System.Collections.Generic.Dictionary`2.Item(`0)" />
Dictionary<TKey, TValue>.this[TKey]
<see cref="P:System.Collections.ArrayList.Item(System.Int32)" />
<see cref="this[int]" />
<see cref="ReadOnlyCollection{T}.this[int]" />
as proposed here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With