Select()

noun

say it: “suh-LEKT” /səˈlɛkt/

The LINQ method that turns each item into something else, such as just its name.

What does Select() do in C#?

Select() — A LINQ operation that transforms every item in a sequence.

class NameFormatter
{
    IEnumerable<string> Uppercase(IEnumerable<string> names)
    {
        return names.Select(name => name.ToUpper());
    }
}

In a sentence

  • “Select(p => p.ProductName) gave me just the names.”

Level: Freelancer · More C# terms at this level

Updated