You need to specify an explicit delegate type. Just use an Action
.
Dispatcher.BeginInvoke(new Action(() => populateInbox(args.Jobs));
You could, however, avoid having to close over the args.Jobs
value like this:
Dispatcher.BeginInvoke(new Action((jobs) => populateInbox(jobs)), jobs);
This is because the single-parameter version of Dispatcher.BeginInvoke
has a different signature in Silverlight than in WPF. In Silverlight, it takes an Action
, which allows the C# compiler to implicitly type your lambda as an Action
. In WPF, it takes a Delegate
(like its Control.BeginInvoke
analog in Winforms), so the C# compiler has to have a delegate type explicitly specified.
Adam Robinson
2010-07-19 19:59:49