多做题,通过考试没问题!

微软认证考试

睦霖题库>其他计算机考试>微软认证考试

You are implementing an ASP.NET application. You add the following code segment. You need to add code to return a list of all Person objects except those with a UserId that is contained in the secretUsers list. The resulting list must not contain duplicates. Which code segment should you use?()

  • A、var secretPeople = (from p in allPeople from u in secretUsers  where p.UserId == u select p).Distinct(); return allPeople.Except(secretPeople);
  • B、return from p in allPeople from u in secretUsers where p.UserId != u select p;
  • C、return (from p in allPeople  from u in secretUsers where p.UserId != u select p).Distinct();
  • D、List people = new List( from p in allPeople from u in secretUsers where p.UserId != u select p); return people.Distinct();
正确答案:A
答案解析:
进入题库查看解析

微信扫一扫手机做题