I've put together a very complicated linq statement that looks like it works properly to me, but is causing the following error:
(11): error CS1977: Cannot use a lambda expression as an argument to a
dynamically dispatched operation without first casting it to a delegate
or expression tree type
The goal of this statement is to grab all of the children of forecastNode whose "date" properties are in the future, then order the remaining children by the "date" property and take the first three.
Hi. Generally in most cases you cannot use conventional LINQ with dynamic-related stuff (since lambdas don't support dynamics). However umbraco razor library goes with dynamic linq extensions included and that allows to write linq queries as strings instead of lambda expressions. With Dynamic LINQ your query can be rewriten someway like this:
Linq Error on Complex Statement
Hello,
I've put together a very complicated linq statement that looks like it works properly to me, but is causing the following error:
The goal of this statement is to grab all of the children of forecastNode whose "date" properties are in the future, then order the remaining children by the "date" property and take the first three.
Hi. Generally in most cases you cannot use conventional LINQ with dynamic-related stuff (since lambdas don't support dynamics). However umbraco razor library goes with dynamic linq extensions included and that allows to write linq queries as strings instead of lambda expressions. With Dynamic LINQ your query can be rewriten someway like this:
Thanks! I actually got it to work with the Where invocation like so:
is working on a reply...