I have an array of objects
MyObjects[] mos = GetMyObjectsArray();
Now I want to move some element with id 1085 to first, so I write code like this in LINQ, is there more elegant way to do this?
mos.Where(c => c.ID == 1085).Take(1).Concat(mos.Where(c => c.ID != 1085)).ToArray();
Note, I want to save positioning of other items, so swaping with first item is not a solution
It’s not LINQ, but it’s how I’d do it with arrays.
Usage: