```
int[] OrderedListToFollow = {1,2,4,5}
int[] ListB = {2,3,4,8,9}

```

Based on the two lists above I need to sort ListB based on the order defined in OrderedListToFollow. Since 3,8,9 are not part of the OrderedListToFollow those can appear in any order, so the acceptable solutions could have any of the following :

```
int[] ListB = {2,4,3,8,9}
int[] ListB = {2,4,8,3,9}
int[] ListB = {2,4,9,3,8}

```

I tried doing this as follows but it does not order it :

```
ListB = ListB.OrderBy(id => OrderedListToFollow.ToList().IndexOf(id)).ToArray();

```

**EDIT** 

The order above works but it places the items not present in OrderedListToFollow first and then the remaining.