# OrderBy()

*noun*

say it: **“OR-der BY”** **/ˈɔːrdər baɪ/**

The LINQ method that sorts items by a value, such as name or price.

## What does **OrderBy()** do in C#?

**OrderBy()** — A LINQ operation that sorts a sequence by a selected key.

```csharp
class NameSorter
{
    IEnumerable<string> Sort(IEnumerable<string> names)
    {
        return names.OrderBy(name => name);
    }
}
```

## In a sentence

- “**OrderBy**(p => p.ProductName) put the products in alphabetical order.”

Level: Freelancer · [More C# terms at this level](https://www.ask-codey.com/glossary?category=c-sharp&level=4)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/orderby
