This one's turning out to be a brain teaser for me. I almost hate to ask for help for fear I might miss out on the endless, sleepless night trying to cypher this mystery. JK
I've got a C# project where I need to display a list of unique objects, but only the newest one based on the type of object. For discussion purposes, let's talk "fruit". Suppose I have a list of fruits, each with a "picked date". There is no primary key. So, my generic list of type "Fruit" might look like...
{'Apple','1/2/2010'}
{'Apple','11/12/2009'}
{'Apple','2/14/2010'}
{'Grape','5/2/2009'}
{'Orange','10/30/2009'}
{'Mango','2/13/2010'}
{'Apple','6/30/2009'}
{'Orange','10/5/2009'}
{'Grape','2/1/2010'}
I need to be able to cut down that list to only the newest of each type of fruit. The results should be...
{'Apple','2/14/2010'}
{'Orange','10/30/2009'}
{'Mango','2/13/2010'}
{'Grape','2/1/2010'}
In my real world situation, I'm using Linq to SQL. So, I'd like to stay in-bounds with what I've been doing.
This is probably something SO simple and, later on, I'm going to be embarassed I even asked. But, I need to know, so I guess I'll just have to make the sacrifice.