i'm trying use linq remove items collection 1 date greater another. know need use datetime.compare() i'm bit unsure how go it.
if allowed, code following:
cilibrary.removeall(x => x.lastsynctowebsite >= x.modified); since doesn't work datetime values how represent statement?
datetime values can compared using >=. need where:
cllibrary.where(x => !(x.lastsynctowebsite >= x.modified)) or equivalently:
cllibrary.where(x => x.lastsynctowebsite < x.modified) this generates new ienumerable, leaving cllibrary unchanged. if cllibrary of type list<t>, can:
cllibrary = cllibrary.where(x => x.lastsynctowebsite < x.modified).tolist(); if cllibrary of type t[], can:
cllibrary = cllibrary.where(x => x.lastsynctowebsite < x.modified).toarray();
Comments
Post a Comment