c# - Comparing two list using lambda expression -


i want list of string based in 2 lists lstjobs , lstpraudits. want planid common in both list.

here code-

list<string> result=reviewmodel.lstjobs.select(x=>x.planid.contains(reviewmodel.lstpraudits.slect(y=>y.planid).tolist())); 

what doing wrong here. code giving error message.

use enumerable.intersect:

list<string> result = reviewmodel.lstjobs.select(x=> x.planid)    .intersect(reviewmodel.lstpraudits.select(y=> y.planid))    .tolist(); 

what doing wrong here

your approach wrong because x.planid.contains search substrings , passing list method. it's wrong approach anyway because don't want compare substrings.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -