using System.Collections.Generic;
public static void Main()
var listA = new List<A>() { new A() { id = 4 }, new A() { id = 5 }, new A() { id = 1 } };
var listB = new List<B>() { new B() { id = 1 }, new B() { id = 4 }, new B() { id = 5 } };
Console.WriteLine("listB (before):");
listB = listB.OrderBy(b => listA.FindIndex(a => a.id == b.id)).ToList();
Console.WriteLine("\nlistB (after):");