C
C#•2w ago
nathanAjacobs

How can I reference multiple generics in summary?

This does not work. Is there a way to do this?
/// <summary>
/// </summary>
/// <returns>
/// A <see cref="Task{Handle{T}}"/>
/// </returns>
public async Task<Handle<T>> Foo()
{
}
/// <summary>
/// </summary>
/// <returns>
/// A <see cref="Task{Handle{T}}"/>
/// </returns>
public async Task<Handle<T>> Foo()
{
}
8 Replies
ero
ero•2w ago
nathanAjacobs
nathanAjacobsOP•2w ago
This is sad 😦 Man that issue was created in 2017, it's almost been 8 years
ero
ero•2w ago
there are simply more important things :p
nathanAjacobs
nathanAjacobsOP•2w ago
Yeah true So this is definitely a hack, as it requires a non generic type to exist and it obviously links to that non generic type if clicked on. This at least gets the highlighting correct though in the summary when hovering over the method in Visual Studio.
/// <summary>
/// You can access the Result from the <see cref="AsyncOperationHandle"/>&lt;<typeparamref name="T"/>&gt; after awaiting assuming the load did not fail.
/// </summary>
/// <returns>
/// An awaitable <see cref="UniTask"/>&lt;<see cref="AsyncOperationHandle"/>&lt;<typeparamref name="T"/>&gt;&gt; instead of <see cref="UniTask"/>&lt;<typeparamref name="T"/>&gt;
/// because as the caller you are responsible for releasing the handle when appropriate.
/// </returns>
public static async UniTask<AsyncOperationHandle<T>> LoadAssetAsync<T>(object key)
{
}
/// <summary>
/// You can access the Result from the <see cref="AsyncOperationHandle"/>&lt;<typeparamref name="T"/>&gt; after awaiting assuming the load did not fail.
/// </summary>
/// <returns>
/// An awaitable <see cref="UniTask"/>&lt;<see cref="AsyncOperationHandle"/>&lt;<typeparamref name="T"/>&gt;&gt; instead of <see cref="UniTask"/>&lt;<typeparamref name="T"/>&gt;
/// because as the caller you are responsible for releasing the handle when appropriate.
/// </returns>
public static async UniTask<AsyncOperationHandle<T>> LoadAssetAsync<T>(object key)
{
}
This might be slightly better because the links actually go to the right type, however the types lose the the appropriate highlighting and just appear blue.
/// <summary>
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns>
/// A <see cref="Task{_}">Task</see>&lt;<see cref="Handle{_}">Handle</see>&lt;<typeparamref name="T"/>&gt;&gt;
/// </returns>
public Task<Handle<T>> Foo<T>()
{
return default;
}
/// <summary>
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns>
/// A <see cref="Task{_}">Task</see>&lt;<see cref="Handle{_}">Handle</see>&lt;<typeparamref name="T"/>&gt;&gt;
/// </returns>
public Task<Handle<T>> Foo<T>()
{
return default;
}
ero
ero•2w ago
worth mentioning that this is ide-specific. these do not even work in vscode, for example.
nathanAjacobs
nathanAjacobsOP•2w ago
Yeah, you're right. It just shows the summary all in white. And links don't work
ero
ero•2w ago
Though if I may say, you have little reason to just return a Task without marking the method as async and awaiting it on the other end. Documentation for methods like that very rarely include that they return a Task<T> and moreso focus on the T Very specific to this example and not a solution to the overall problem, but might do you some good in this case
nathanAjacobs
nathanAjacobsOP•2w ago
Yeah I left it off there by mistake, I was just showing the documentation portion. That is a good point though

Did you find this page helpful?