Multiple choice technology programming languages

List Names = new List(); Names.Add("A"); Names.Add("B"); Names.Add("C"); var res = Names.Where(n => n == "D"); res is the type of

  1. List<string>

  2. IEnumerable<string>

  3. List<object>

  4. IEnumerable<object>

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The Where() extension method on List returns IEnumerable, the deferred execution sequence interface. This is the standard LINQ return type for filtering operations. The actual runtime type is a nested iterator class, but the declared return type is IEnumerable. It is not List or the object variant.