I'm working on this LINQ query. I'd like the resulting list return a list of records that contain duplicates exclusively, based on the EMailAddress1 field and grouped by the EMailAddress1 field.
For instance:
- emailaddress1@gmail.com
- emailaddress1@gmail.com
- emailaddress2@gmail.com
- emailaddress2@gmail.com
- emailaddress2@gmail.com
- emailaddress3@gmail.com
- emailaddress3@gmail.com
etc.
Any advice on this? Thanks.
var contacts = (from c in xrm.ContactSet
where c.StateCode != 1
orderby c.EMailAddress1, c.CreatedOn
descending select new {
c.FirstName,
c.LastName,
c.EMailAddress1,
c.ContactId,
c.CreatedOn }).ToList();