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

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -