Generate a C# delegate method stub

醉酒当歌 提交于 2019-12-23 02:51:12

问题


Anyone know how to automatically create a delegate stub method?

In WPF it seems im constantly having to pass delegates around. i would like to be able to type a method name that doesnt exist and have a method stub automatically generated...currently i'am having to constantly reference the docs to get the delegate signature and then manually create method with matching signature.


回答1:


Use an IDE plugin like Refactor Pro! It also allows you to convert your delegates to instance methods, or if its a one-liner, into a lambda. I tend to start typing using a lambda and then hovering my cursor over the parms gives you the types available.

Or. Wait till Visual Studio 10 which would have this all built in. But until then use either of the aforementioned :)



来源:https://stackoverflow.com/questions/482510/generate-a-c-sharp-delegate-method-stub

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!