Question: I have a `List<MyClass>` with `Status` and `Date` fields. I want to return a single `MyClass` where the `Status = X`.

The problem is there could be more than one in the list, in which case I want to sort on `Date` and return the latest one. 

Can this be done in LINQ in a single expression?

Answer: 
You can use lambda expression: 

```
var yourResult = dbo.YourList.OrderByDescending(t=>t.Date).FirstOrDefault(t=>t.Status == 'X');

```
If `list` already located at memory try this:

```
var answer = list.Where(x => x.Status == X).OrderBy(x => x.Date).LastOrDefault();

```

At case of Entity Framework try another approach:

```
var answer = context.Table.Where(x => x.Status == X).OrderByDescending(x => x.Date).FirstOrDefault();

```