I have a MyItem class with three properties, as shown below:
class MyItem
{
private string _name;
private int _value
private DateTime _TimeStamp;
public MyItem(string name, int value, string timeStamp)
{
this._name = name;
this._value = value;
this._timeStamp = DateTime.Parse(timeStamp);
}
public string Name
{ get {return this_name; } }
public int Value
{ get {return this._value; } }
public DateTime TimeStamp
{ get {return this._timeStamp; } }
}
I also have a MyItem list as shown below:
var myItems = new List<MyItem>() {
new MyItem("A", 123, "23/02/2012"),
new MyItem("A", 323, "22/02/2012"),
new MyItem("B", 432, "23/02/2012"),
new MyItem("B", 356, "22/02/2012"),
}
How can I GROUP BY myList so that I ONLY stay with items that have a maximum TimeStamp? those. result below:
"A" 123 23/02/2012<br>
"B" 432 23/02/2012<br>
Thanks in advance.
MaYaN source
share