imagine to have a class (and corresponding db table) as follows
class Price{
int ItemID;
int ItemTypeID;
string ItemName;
string ItemTypeName;
float Price;
}
I am seraching for a new to query it via LINQ in order to get the list of distinct Items (possibly with the use of Take() and Skip() methods) and nested the list of all associated prices.
Any suggestion?
EDIT: To make the question simpler here’s an example
Imagine to have 3 “prices” as following
1, 1, Ball, Blue, 10
1, 2, Ball, Red, 20
2, 1, Frisbee, Blue, 30
I would like to put them in a simplified structure
List<Item>
where
class Item
{
string ItemName;
string ItemTypeName;
List<Price> Prices;
}
and
class Price
{
float Price;
}
It sounds like maybe you want a GroupBy. Try something like this.