生成一个C#的委托方法存根 [英] Generate a C# delegate method stub

查看:317
本文介绍了生成一个C#的委托方法存根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道如何自动创建一个委托存根方法?

Anyone know how to automatically create a delegate stub method?

在WPF似乎IM不得不经常来回传递代表。我想能够输入,这并不存在一个方法名,并有自动生成......目前我'不必经常引用文档来获取委托签名,然后手动创建方法匹配签名的方法存根。

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.

推荐答案

使用一个IDE插件像重构临!它还允许您将委托转换为实例方法,或者它的一个班轮,为lambda。我倾向于开始使用一个lambda打字,然后悬停我的光标在PARMS为您提供了可用的类型。

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.

或者。等到的Visual Studio 10,将所有这一切建成但在此之前使用上述任。)

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

这篇关于生成一个C#的委托方法存根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆