Filtering a List using LINQ -


hello have class called empowercalendarcode:

it has following fields calendarcode, calendarname, effectivestartdate, empowertaxtype, longagencycode, taxdepositfrequencybasetypeid.

i want filter list based on longagenycode , empowertaxtype. lets say:

public ilist<empowercalendarcode> getempowercalendarcodes(string longagencycode, string empowertaxtype) {       //todo:  } 

if more 1 empowercalendarcode same longagencycode, empowertaxtype has same taxdepositfrequencybasetypeid , should pick 1 has recent effectivestartdate. how ould able write linq query. okay if have 2 3 queries result.

any ideas , suggestions appreciated!

try this:

ctx.empowercalendarcodes .where(a=>a.longagencycode == longagencycode && a.empowertaxtype == empowertaxtype) .orderbydescending(a=>a.effectivestartdate) .firstordefault(); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -