Monday, 26 August 2013

getting specific x items from list using linq

getting specific x items from list using linq

I trying to get specific x items from a list i created.
List<Item> il = (List<Item>)(from i in AllItems
where i.Iid == item.Iid
select i).Take(Int32.Parse(item.amount));
I get the following error:
"Unable to cast object of type 'd__3a1[AssetManagement.Entities.Item]' to
type 'System.Collections.Generic.List1[AssetManagement.Entities.Item]'."
How can it be fixed and why is this happening ? Thanks in advance.

No comments:

Post a Comment