生成 C# 委托方法存根

发布于 2024-07-12 23:07:10 字数 126 浏览 7 评论 0原文

有人知道如何自动创建委托存根方法吗?

在 WPF 中,我似乎经常需要传递代表。 我希望能够输入一个不存在的方法名称,并自动生成一个方法存根...目前我必须不断引用文档来获取委托签名,然后手动创建具有匹配签名的方法。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酷炫老祖宗 2024-07-19 23:07:10

使用像 Refactor Pro 这样的 IDE 插件! 它还允许您将委托转换为实例方法,或者如果它是单行代码,则转换为 lambda。 我倾向于开始使用 lambda 进行输入,然后将光标悬停在参数上即可获得可用的类型。

或者。 等到 Visual Studio 10 内置了这一切。但在那之前请使用上述任何一个:)

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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文