I have a ASP.NET MVC4 Application. My view get a List from my controller. I want to select these list with lambda expression but I get the following error:
Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type
List<project.Models.LAYER> layers = new List<project.Models.LAYER>();
layers = @Model.layers.Select(x => x.KONT == "EUROPE");
@Model.layers is a List
NOW I TRIED THAT: BUT THE SAME ERROR:
@{
List<project.Models.LAYER> layers = Model.layers.Where(x => x.KNOT == "EUROPE").ToList();
}
layers
and the immediately assign it another value? – Codo 17 hours agoModel.layers
? Is it aList<project.Models.LAYER>
? Probably not as the error message indicates there is a dynamic type involved somewhere. – Codo 16 hours ago