c# - Linq - Except one list with items in another -


i think question easy, i'm newbie in linq... i'm having hard time here

my system calls service, called servicetop, returns me list of itemtop {id, name}.

these itemstop aren't in system, user can choose itemtop import system.

the imported itemstop becomes object item { id, idtop, name }

so, when system calls servicetop, before showing them user, must filter imported items list.

let's go code:

ilist<itemstop> listtop = new servicetop().getitemstop();  ilist<items> list = new wcfserviceclient().getitems();  var filteredlisttop = listtop.select( => i.id ).except( => i.idtop ); 

this kind of works, returns list of strings containing id.

i'd select both id , name of top.

thanks in advance.

change this:

var filteredlisttop = listtop.select(i => i.id ).except( => i.idtop ); 

to this:

var filteredlisttop = listtop.select(i => new { id = i.id, name = i.name} ).except( => i.idtop ); 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -