I have a table of data having startdate
, enddate
and time for example
startdate enddate time
03/19/2020 03/19/2020 15:23
03/19/2020 03/20/2020 12:26
03/19/2020 03/19/2020 05:23
03/19/2020 03/19/2020 09:23
03/19/2020 03/21/2020 04:23
I want to use LINQ query to get a minimum of time when startdate = enddate
I use this query
time = table.Where(x => x.StartDate == x.EndDate).Min(x=>x.time)
but when I run this code it gives me exception InValidOperationException was unhandled by user code
another query I have to use is
time = table.OrderBy(x=>x.StartDate == x.EndDate).First().Time
but it is giving me an incorrect output
Any suggestion how can I fix this
Aucun commentaire:
Enregistrer un commentaire