Is it possible, that having a constant
public const string MyString = "myValue"
to get its value "myValue" in xml comments ? I'm interested in this for generating swagger documentation.
/// <summary>
/// Creates a new resource.
/// </summary>
/// <param name="request">The request object.</param>
/// <returns code="200">The id of the new resource.</returns>
/// <response code="400">
/// <see cref="Errors.BadRequestCodes.MyString"/><para/>
/// </response>
This is an example of a documented endpoint. And in the swagger ui, instead of seeing the message "myValue" on the 400 status code section I'm actually seeing "Errors.BadRequestCodes.MyString". Is there any way of achieving this?
Have you tried using
<inheritdoc>
, and just adding the const value in the first file and then referring to it in the second?https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/inheritdoc
Rendering constants into XML documentation?