nerdexam
Microsoft

70-515 · Question #28

You are implementing an ASP.NET application. You add the following code segment. public List<Person> GetNonSecretUsers() { string[] secretUsers = {"@secretUser", "@admin", "@root"}; List<Person>…

The correct answer is A. var secretPeople = (from p in allPeople. See the full explanation below for the reasoning.

Question

You are implementing an ASP.NET application. You add the following code segment. public List<Person> GetNonSecretUsers() { string[] secretUsers = {"@secretUser", "@admin", "@root"}; List<Person> allpeople = GetAllPeople(); ... } 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?

Options

  • Avar secretPeople = (from p in allPeople
  • Breturn from p in allPeople
  • Creturn (from p in allPeople
  • DList<Person> people = new List<Person>(

How the community answered

(35 responses)
  • A
    71% (25)
  • B
    9% (3)
  • C
    3% (1)
  • D
    17% (6)

Community Discussion

No community discussion yet for this question.

Full 70-515 Practice