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

Posted by carlmon on Stack Overflow See other posts from Stack Overflow or by carlmon
Published on 2010-04-20T08:24:15Z Indexed on 2010/04/20 11:23 UTC
Read the original article Hit count: 331

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about resharper

Related posts about lambda