# Sorting

* OrderBy()&#x20;
* OrderByDescending()&#x20;
* ThenBy()&#x20;
* ThenByDescending()
* Reverse()

```csharp
// Some code
var itemList = context.Items.Where(x => !x.Items && x.DeliverySelection)
                            .OrderByDescending(x => x.Delivery.SubmissionDate)
                            //.ThenBy(x => x.Item);
```

Notes

*   If you want to call `ThenBy`, you should call `OrderBy` first or you need to cast it to `IOrderedQueryable`:

    ```csharp
    var r = ((IOrderedQueryable<dynamic>)result).ThenBy(...);
    ```


* `ThenBy` will work sorting the second fields in the order you want if there are fields in `OrderBy` with equal value
