Why is the LINQ "apply-to-all" method named Select?

linq, naming-conventions

Solution

It's really identical to map from functional languages. The reason it's named `Select` is that it's designed to be used as a part of LINQ which uses SQL-like keywords.

from item in collection
where item.Value == someValue
select item.Name

is translated to:

collection.Where(item => item.Value == someValue)
          .Select(item => item.Name)

it would be a little inconsistent if `Select` was named `Map`; something like:

collection.Filter(item => item.Value == someValue)
          .Map(item => item.Name)

In fact, many people use LINQ without having heard of functional programming at all. To them, LINQ is a method to retrieve data objects and query them easily (like SQL queries are). To them, `Select` and `Where` make perfect sense. Much more than `Map` and `Filter`.

Problem

When I read code that uses `Select` I think "select-all-where". When I read code that uses `Map` I think "this-to-that" or "apply-to-all". I can't be the only person that feels the name `Select` is confusing. Map

Original source