An array is not the best data structure for the operation you are trying to perform, and this may require copying a large number of elements. For what you do, you must use the List.
First, define a list expansion method as follows:
static class ListExtensions { public static bool MoveToFront<T>(this List<T> list, Predicate<T> match) { int idx = list.FindIndex(match); if (idx != -1) { if (idx != 0)
Then you can use the MoveToFront extension method (modified from your example):
List<int> mos = GetMyObjectsList(); mos.MoveToFront(i => i == 1085);
source share