I am looking to resort one array based on another array. In a previous project I needed to just get a list of the disordered items, and applying that code to my current scenario I get this
$definedSet = @('C', 'B', 'D', 'A')
$history = @('A', 'B', 'C', 'D')
$disordered = $history.Where({-not [Linq.Enumerable]::SequenceEqual([string[]]$history, [string[]]$definedSet)})
$disordered
Which does indeed give me a list of all four items, because they are all out of order.
However, in this new scenario I need to resort $history based on $definedSet. The key being that there could be items in one that aren't in the other. But I am starting with a simpler problem, and that has me stumped. I feel certain [Linq.Enumerable] is the key, obviously, but my Google-Fu is not pointing me towards a solution. I have tried the Microsoft Docs article on the Enumerable class, and my brain... melted.