Re# 中未解析的 lambda 表达式
我无法用一段代码弄清楚 Re# 抱怨什么。一切都编译正常并按预期工作,但 Re# 似乎无法在不提供任何建议的情况下解析表达式。查看附件中的代码和错误。
有优惠吗?
I can't figure out what Re# is complaining about with a piece of code. Everything compiles ok and works as it should, but Re# can't seem to resolve the expression without offering any suggestions. Look at the attachment for code and error.
Any offers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的代码没问题。这是 Resharper 中的一个错误,现已在 5.1 版本中修复。
到处都有同样的警告(在某种程度上我关闭了 Re#,直到我得到 5.1 更新)。我们的也是 Silverlight 4 应用程序。
现在,Re# 5.1 在 VS 2010 中的表现要好得多。与智能感知自动完成的冲突也消失了。
Your code is fine. This was a bug in Resharper, now fixed in version 5.1.
Had the same warning all over the place (to the extent I turned off Re# until I got the 5.1 update). Ours was also a Silverlight 4 app.
Re# 5.1 behaves a lot better with VS 2010 now. Clashes with intellisense autocomplete have also vanished.
我没有使用过 Resharper,所以我在这里可能会偏离主题,但 Invoke 接受委托或操作; lambda 表达式可以转换为其中任何一个(如 这个答案来自 Jon Skeet)。也许 Resharper 不知道应该将其投射到其中的哪一个。
如果您将其更改为该
错误很可能会消失。
I haven't used Resharper so I could be off the mark here, but Invoke accepts a Delegate or an Action; a lambda expression can be converted to either of those (as explained in this answer from Jon Skeet). Perhaps Resharper doesn't know which of those it should be cast to.
If you change it to
the error will most likely go away.