Compare DateTime Lists, c# linq -


i have list in c#

list<dates>  public class dates {     public datetime start {get; set;}     public datetime end {get; set;} } 

in list:

start - end

  1. 2014-03-17 09:00:00 - 2014-03-17 10:00:00
  2. 2014-03-17 10:59:59 - 2014-03-17 11:44:59

how check if starttocheck between start, same endtocheck end list?

for example:

starttocheck = 2014-03-17 11:00:00 endtocheck = 2014-03-17 12:00:00 

obviously, starttocheck in list nr2, not find it.

i tried

if (start <= starttocheck && end >= endtocheck) 

but not working... help, please?

thanks

if want detect overlaps:

yourlist.where(x=> x.start <= endtocheck && x.end >= starttocheck) 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -