开发者

How to stop ReSharper from showing error on a lambda expression where Action is expected?

开发者 https://www.devze.com 2022-12-27 17:25 出处:网络
In Silverlight, System.Windows.Threading\'s Dispatcher.BeginInvoke() takes an Action<T> or a delegate to invoke.

In Silverlight, System.Windows.Threading's Dispatcher.BeginInvoke() takes an Action<T> or a delegate to invoke.

.NET allows me to pass just the lambda expression. but ReSharper sees it as an error, saying "Cannot resolve method 'BeginInvoke(lambda expression)'": Dispatcher.BeginInvoke(() => { DoSomething(); })

The error goes away if I explicitly create the Action around the expression like this: Dispatcher.BeginInvoke(new Action<object>(o => { DoSomething(); }));

I prefer the least amount of code in this case for the best readability. Is there a way to disable this specific ReSharper开发者_如何转开发 error notification? I tried some of the options, but could not find it.

Thanks, Carl


Right now ReSharper 5 has problems with Silverlight 4. All of these issues will be handled in the bugfix update.

The root of these problems is that SL3 and SL4 mscorlibs have different types defined in, but the same Full Assembly Name.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号