[英]code documentation, get value from constant
Is it possible, that having a constant有没有可能,有一个常数
public const string MyString = "myValue"
to get its value "myValue" in xml comments?在 xml 评论中获得其价值“myValue”? I'm interested in this for generating swagger documentation.
我对生成 swagger 文档感兴趣。
/// <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".
在 swagger ui 中,我实际上看到的是“Errors.BadRequestCodes.MyString”,而不是在 400 状态代码部分看到消息“myValue”。 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?您是否尝试过使用
<inheritdoc>
,只是在第一个文件中添加 const 值,然后在第二个文件中引用它?
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/inheritdoc https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/inheritdoc
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.