David López
David López

Reputation: 364

How to create documentation header for a Object<CustomObject> return type in method c#

I'm trying to create a documentation response header in a method like this

public Task<CustomObject> AuthUserAsync()
{
}

So, as I understand it should be something like

/// <summary>
/// Description.
/// </summary>
/// <returns>A <see cref="Task"/><<see cref="CustomObject"/>> representing the operation.</returns>
public Task<CustomObject> AuthUserAsync()
{
}

But I'm unable to see the documentation when hover the mouse on the method

Any ideas?

Upvotes: 1

Views: 138

Answers (1)

PMF
PMF

Reputation: 17185

The proper syntax to use a template argument in a documentation header is:

/// <summary>
/// Description.
/// </summary>
/// <returns>A <see cref="Task{TResult}"/> representing the operation.</returns>
public Task<CustomObject> AuthUserAsync()
{
}

Note that the angle brackets are replaced by {}, because angle brackets would make the XML invalid at that point. You cannot put Task{int} there, even though that would be more exact, because Task<int> is not a type you can create a reference to. If you write it without the cref, you can do

/// <returns>A Task&gt;int&lt; representing the operation.</returns>

You are still not allowed to use literal < or > characters, though.

Upvotes: 1

Related Questions