Hopefully I can explain my situation well enough for some help.
Basically, I have a list (ItemList) consisting of ItemRows as follows
ItemRows
public string ItemId { get; set; }
public string ItemDate { get; set; }
public string ItemPrice { get; set; }
I am currently in a foreach loop that passes the current variables to another function in each iteration. However, when I transfer the price, I only ever want to transfer the highest price for the ItemDate.
foreach item in ItemList
{
AnotherFunction(ItemId, ItemDate, MaxPriceByDate);
}
So, if I had the following 4 rows of data ....
123, 01/01/2015, $15
234, 01/01/2015, $20
345, 01/02/2015, $10
456, 01/02/2015, $5
this is how I want the loop to pass information along:
first iteration: 123, 01/01/2015, $20
second iteration: 234, 01/01/2015, $20
third iteration: 345, 01/02/2015, $10
fourth iteration: 456, 01/02/2015, $10
Basically I am looking for help in how to select the dollar amount from my list that uses the foreach loop, but I want it to always select the highest amount by date from the specified list for iteration.
Hope this makes sense and I thank you for your help!