问题
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