字段的详细 XML 文档。有可能吗?
我已经为其定义了一个回调字段和事件属性:
private Action<int, int, TaskCallbackArgs> _callbackEvent
/// <summary>
/// Provides a callback event for task.
/// </summary>
public event Action<int, int, TaskCallbackArgs> CallbackEvent
{
add
{
_callbackEvent += value;
}
remove
{
_callbackEvent -= value;
}
}
在我的代码中,我调用了 _callbackEvent
。好吧,但是当我输入 _callbackEvent(
VS 向我显示 IntelliSense,我的方法需要 (int arg1, int arg2, TaskCallbackArgs arg3)
参数。 当我稍后打开这段代码时,我不记得arg1、arg2和arg3是什么。
有没有办法在字段中使用 XML 文档,如下所示?
/// <summary>
/// Description
/// </summary>
/// <param name="current">Param description...</param>
/// <param name="total">Param description...</param>
/// <param name="additional">Param description...</param>
谢谢!
I have define a callback field and event property for it:
private Action<int, int, TaskCallbackArgs> _callbackEvent
/// <summary>
/// Provides a callback event for task.
/// </summary>
public event Action<int, int, TaskCallbackArgs> CallbackEvent
{
add
{
_callbackEvent += value;
}
remove
{
_callbackEvent -= value;
}
}
In my code I have invoke the _callbackEvent
. All right, but when I type _callbackEvent(
VS show me IntelliSense that my method want (int arg1, int arg2, TaskCallbackArgs arg3)
arguments.
When I open this code some time later I don't remember what is arg1, arg2 and arg3.
Is there a way to use XML Documentation for field as following?
/// <summary>
/// Description
/// </summary>
/// <param name="current">Param description...</param>
/// <param name="total">Param description...</param>
/// <param name="additional">Param description...</param>
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Action
是一个带有三个参数的委托类型。您可以为该字段编写 XML 文档注释,但这仅适用于该字段本身。
要为委托参数添加参数名称和文档注释,您需要创建自己的委托类型。
例如:
Action<int, int, TaskCallbackArgs>
is a delegate type that takes three parameters.You can write an XML doc comment for the field, but that will only apply to the field itself.
To add parameter names and doc comments for the delegate parameters, you need to create your own delegate type.
For example: