开发者

distinct in the two list

How can i get the uniques in the two list

this is my two list

var listUtiPcs = (from utiPc in datacontx.UTILIZACAOPCs
                        join pc in datacontx.COMPUTADORs on utiPc.ComputadorID equals pc.IdComputador
                     where utiPc.Removido==false
                     select pc);

            var listpcs = (from usr in datacontx.COMPUTADORs
           开发者_开发知识库                select usr);

The first return the computer in use, the second returns the list of the computer. I want to return the computer that are not in use. how can i do it?


You have a list of computers, you have a list of computers in use, and you want a list of computers not in use. That's going to be the Except method.

var remaining = listOfAll.Except(subset);
// in your terms 
var unusedComputers = listpcs.Except(listUtiPcs);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜