I have a message list having members:
Text = m.Text, User = m.User, Date = m.Date
This list include all the messages like
Text = "How Are You"
User = "Michael"
Date = "1/1/12"
Text = "Well Done"
User = "Michael"
Date = "2/1/12"
Text = "Who?"
User = "John"
Date = "1/1/12"
I kindly require to get the newest messages from the people which won’t show multiple messages from the same person and give only the last one like:
Text = "Well Done"
User = "Michael"
Date = "2/1/12"
Text = "Who?"
User = "John"
Date = "1/1/12"
As you see; I want to eliminate the previous message from the same person.
I am currently using:
var messages = (from m in mList select new
{
Text = m.Text,
User = m.User,
Date = m.Date
}).ToList();
What should I add to this query to achieve my goal?
Thank you!
1 Answer