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

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)