How to sort List <T>

  • Thread starter Thread starter Jeff0803
  • Start date Start date
J

Jeff0803

Guest
I have a List<T> and each item is a class Message like following.

List<Message>




public class Message
{
private short m_direction;
private DateTime m_message_datetime;
private string m_message_body;
private string m_firstname;
private string m_sid;
private string m_phoneno;
public Message(string sid, short direction, DateTime message_datetime, string message_body, string firstname, string phoneno)
{
m_sid = sid;
m_direction = direction;
m_message_datetime = message_datetime;
m_message_body = message_body;
m_firstname = firstname;
m_phoneno = phoneno;
}
public string SID
{
get { return m_sid; }
set
{
m_sid = value;
}
}
public string MessageBody
{
get { return m_message_body; }
set
{
m_message_body = value;
}
}
public DateTime MessageDateTime
{
get { return m_message_datetime; }
set
{
m_message_datetime = value;
}
}
public Int16 Direction
{
get { return m_direction; }
set
{
m_direction = value;
}
}
public string FirstName
{
get { return m_firstname; }
set
{
m_firstname = value;
}
}
public string PhoneNo
{
get { return m_phoneno; }
set
{
m_phoneno = value;
}
}
}

I want to sort list order by m_message_datetime as ascending order.

Ho to do this?

Continue reading...
 
Back
Top