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.
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.
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.
One of the major reasons Select comes last is to make Intellisense work. By putting the source of the sequence first (from statement), Intellisense can work properly.