Cam*_*tin 3 c# inheritance comments overriding xml-documentation
有时我会覆盖基类中的方法.有时我甚至用空方法覆盖它们,因为我想要的是防止这种行为.
在过去,我会写这样的东西来表明绕过基本方法的意图:
protected override void OnMouseUp(MouseEventArgs e)
{
// base.OnMouseUp(e);
}
Run Code Online (Sandbox Code Playgroud)
(我知道注释的代码行是一件坏事.我曾经这么做过)
但我想做得更好:
<summary>?)文档中写了什么?对于文档,我只使用内置文档标记:
/// <summary>Exiting drag mode on mouse up</summary>
protected override void OnMouseUp(MouseEventArgs e)
{
...
Run Code Online (Sandbox Code Playgroud)
为澄清意图,我只想发表评论
protected override void OnMouseUp(MouseEventArgs e)
{
// not calling the base implementation
...
}
Run Code Online (Sandbox Code Playgroud)
这条线
// base.OnMouseUp(e);
Run Code Online (Sandbox Code Playgroud)
让人觉得这个电话暂时被注释掉了(可能有人忘记恢复它)
| 归档时间: |
|
| 查看次数: |
1745 次 |
| 最近记录: |