[英]How to add a comment to the new method stub in Visual Studio?
如果我让 VS 添加一个新方法,它会创建如下内容:
public void DoSomething(object withThis)
{
throw new NotImplementedException();
}
我想添加评论并得到类似的东西:
public void DoSomething(object withThis)
{
throw new NotImplementedException(); //TODO: Implement me!
}
这样一个新的且未实现的方法将自动出现在任务列表中。
最简单的解决方案是编辑任务列表属性,您可以添加到任务列表NotImplementedException
。 https://docs.microsoft.com/en-us/visualstudio/ide/using-the-task-list?view=vs-2022
我没有测试过这个特定的场景,但你可以尝试编辑相应的 *.snippet 文件。 它称为MethodStub.snippet
,位于我的 PC 上的x:\Microsoft Visual Studio\2019\Enterprise\VC#\Snippets\1033\Refactoring\MethodStub.snippet
中。
结果可能如下所示:
<Code Language="csharp">
<![CDATA[$signature$
{
$end$throw new $Exception$(); //TODO: Implement me!
}]]>
</Code>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.