Visual Studio 2010 中的 C# 事件订阅
因此,在 Visual Studio 中,如果您键入如下内容:
retryExecutor.Retrying +=
然后会弹出一个小工具提示,提示您可以按 TAB 将其变成这样:
retryExecutor.Retrying+= new EventHandler(retryExecutor_Retrying);
然后,如果您按 TAB 再次,它生成:
void retryExecutor_Retrying(object sender, EventArgs e)
{
throw new NotImplementedException();
}
当然,这非常有用。但我发现自己更经常需要这样的构造:
retryExecutor.Retrying += (o, e) =>
{
};
那么,有没有办法添加新的快捷方式,或者至少更改按 TAB 的功能?
So, in visual studio, if you type something like this:
retryExecutor.Retrying +=
Then a little tooltip thing pops up saying that you can press TAB to turn it into this:
retryExecutor.Retrying+= new EventHandler(retryExecutor_Retrying);
Then if you press TAB again, it generates:
void retryExecutor_Retrying(object sender, EventArgs e)
{
throw new NotImplementedException();
}
Of course, this is very useful. But I find myself more often needing a construction like so:
retryExecutor.Retrying += (o, e) =>
{
};
So, is there anyway to add a new shortcut, or at least change the functionality of pressing TAB?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您始终可以创建并使用 IntelliSense 代码片段。在这里阅读更多相关信息:http://msdn .microsoft.com/en-us/library/ms165392%28v=VS.100%29.aspx
You can always crate and use IntelliSense code snipppets. Read more about it here: http://msdn.microsoft.com/en-us/library/ms165392%28v=VS.100%29.aspx