配置 VS 2010,使其不添加 new EventHandler(...);通过 += 添加 EventHandler 时
可能的重复:
我可以在 Visual Studio 中自定义自动事件处理程序生成吗?< /a>
我可以配置 VS2010 Intellisense 以便
SomeEvent += Some_Method;
执行此操作:而不是执行此操作吗
SomeEvent += new EventHandler(Some_Method);
在通过 += 添加事件处理程序并按 Shift 键时
?我知道这对于生成的 IL 来说没有任何区别,但我个人更喜欢第一个版本。它更容易阅读,并且当我将 EventHandler 类型更改为不同的类型时,我不必去修复 += / -= 调用。
Possible Duplicate:
Can I customize automatic event handler generation in Visual Studio ?
Can I configure VS2010 Intellisense so that it does this:
SomeEvent += Some_Method;
instead of this:
SomeEvent += new EventHandler(Some_Method);
when adding an EventHandler via += and pressing the Shift key?
I understand that this doesn't make any difference as far as the generated IL is concerned but I personally much prefer the first version. It is easier to read and I don't have to go and fix the += / -= calls when I go and change the EventHandler type to something different.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,抱歉。我只是采用默认行为,然后在为我删除方法后删除多余的内容。
Nope, sorry. I just go with the default behavior and then delete the extra fluff after it's stubbed out the method for me.