Compare only the date portion not the time of the selectedDateList or courseDateList
So the expected output should be:
5/7/2014 7:00:00 AM
5/7/2014 12:00:00 PM
void Main()
{
var courseDateList = new[]
{
new Dates { Start= Convert.ToDateTime("05/05/2014 07:00:00 AM")},
new Dates { Start= Convert.ToDateTime("05/05/2014 12:00:00 PM")},
new Dates { Start = Convert.ToDateTime("05/06/2014 07:00:00 AM")},
new Dates { Start = Convert.ToDateTime("05/06/2014 12:00:00 PM")},
new Dates { Start= Convert.ToDateTime("05/07/2014 07:00:00 AM")},
new Dates { Start= Convert.ToDateTime("05/07/2014 12:00:00 PM")}
};
var selectedDateList = new[]
{
new Dates { Start= Convert.ToDateTime("05/05/2014 08:00:00 AM")},
new Dates { Start= Convert.ToDateTime("05/06/2014 05:00:00 PM")}
};
selectedDateList.Dump();
courseDateList.Dump();
}
public class Dates
{
public DateTime Start {get; set;}
}
Lawrence PondPosted Oct 24, 2014, 4:15 PM
var mylookup = selectedDateList.ToLookup(u=>u.Start);
var listdiff = courseDateList.Where(u=>(!mylookup.Contains(u.Start)))
Lawrence PondPosted Oct 24, 2014, 1:08 AM
Ramesh MaruthiPosted Oct 23, 2014, 9:33 PM