The context
public class Item
{
public int Index;
public string Text;
}
...
var items = new List<Item>
{
new Item {Index=1, Text="Data #1"},
new Item {Index=8, Text="Data #8"},
new Item {Index=4, Text="Data #4"},
};
The code
var data = (from item in items
orderby item.Index
select item).ToList();
The result
Data[0] = Data #1
Data[1] = Data #4
Data[2] = Data #8
What is wanted
Data[0] = null
Data[1] = Data #1
Data[2] = null
Data[3] = null
Data[4] = Data #4
Data[5] = null
Data[6] = null
Data[7] = null
Data[8] = Data #8
How to achieve this with Linq?