Reputation: 192637
In C#, I can attach documentation for properties, methods, events, and so on, directly in the code using XML Documentation Comments.
I know how to insert a reference to a particular method:
<see cref="MethodName(TypeForArg1, TypeForArg2..)"/>
Is there a way to insert a reference to a method group? Where I've got multiple overloads of the same method name...
I tried
<see cref="M:MethodName"/>
..but that did not work.
Upvotes: 12
Views: 1059
Reputation: 149068
It appears that this behavior occurs in Visual Studio 2012-2022:
<see cref="MethodName"/>
Will generate a warning:
Ambiguous reference in cref attribute: 'MethodName'. Assuming '…', but could have also matched other overloads including '…'.
But adding an M:
in front get's rid of the warning:
<see cref="M:MethodName"/>
Upvotes: 2
Reputation: 7150
This is now supported in Sandcastle.
To reference a method group, the following syntax is required:
/// <summary>
/// Reference to a method group with two items:
/// <see cref="O:Full.Declaring.Namespace.TypeName.Foo"/>
/// </summary>
void Foo() { }
void Foo(int x) { }
Note that this syntax does still have some limitations, as described this C# language feature request.
Upvotes: 0