Question: I'm sure that this can be easily done with Linq but I can't figure it out.

```
var ls1 = plotter.Model.Series.FirstOrDefault(x => x.IsSelected);
var ls2 = plotter.Model.Series.FirstOrDefault((x => x.IsSelected)&&(ls2!=ls1));

```

What I'm pretending to do is to obtain the two first objects that have their property `IsSelected` set to true.

I can't use the syntax written above because the compiler can't use "local variable `ls2` before it is declared".

Answer: 
Use [Where](http://msdn.microsoft.com/en-us/library/bb534803.aspx) to filter only the selected results then use [Take](http://msdn.microsoft.com/en-us/library/bb503062.aspx) to select the first two e.g.

```
plotter.Model.Series.Where(x => x.IsSelected).Take(2);

```
```
var ls1 = plotter.Model.Series.Where(x => x.IsSelected).Take(2);

```