I am using the Facebook C# SDK to get data. I want to use parallel.foreach but cannot use it – instead, an error occurs:
Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type
So is there any way I can convert data retrieved to a list?
dynamic friends = app.Get("me/friends");
Parallel.ForEach(friends.data, friendsData =>
{
Interlocked.Increment(ref infoCount);
LoadFriends(friend, infoCount);
});
If you can’t use a lambda expression, have you tried an anonymous method?