c# - LINQ query for retrieving data from list -
c# - LINQ query for retrieving data from list -
i have list collection of message objects.
public class message { public int id { get; set; } public string body { get; set; } public string sender { get; set; } public datetime timestamp { get; set; } }
i want 1 message recent timestamp each sender. how do using linq?
var q = n in table grouping n n.senderinto g select g.orderbydescending(t=>t.timestamp).firstordefault();
c# linq
Comments
Post a Comment