Wednesday, August 1, 2012

How to select unique class list by one property in LINQ? like DISTINCT in TSQL

classList.GroupBy(prop => prop.Id).Select(group => group.FirstOrDefault()).ToList()

http://rayaspnet.blogspot.ca/2011/08/how-to-implement-sql-distinct-keyword.html

No comments:

Post a Comment