Question: This should be very simple but I searched and couldn't find a similar linq example. 

I have a function below.

```
viewModel.SLGDeptSalesList = viewModel.SLGDeptSalesList.Where(
    (value, index) => index == 0).ToList();

```

It returns an index within the sales list. 

I need to customize it to return multiple hard coded index's such as 1,3,4,6. 

How can I use linq to do this in one line? 

Thanks a bunch!

Answer: 
You can do a `Select` on your hardcoded list of indices, to transform them into corresponding elements in the `viewModel.SLGDeptSalesList` list:

```
viewModel.SLGDeptSalesList = new List<int> { 1, 3, 4, 6 }.Select(x => viewModel.SLGDeptSalesList[x]).ToList();

```
You could use `Contains` on an array:

```
var indices = new [] {1, 3, 4, 6};
viewModel.SLGDeptSalesList = viewModel.SLGDeptSalesList.Where(
  (value, index) => indices.Contains(index)).ToList();

```

Using `Contains` on an array is a common technique when you have queries you want to execute on SQL (not in your case, but in general), e.g. <https://blogs.msdn.microsoft.com/alexj/2009/03/25/tip-8-how-to-write-where-in-style-queries-using-linq-to-entities/>