This gives me the desired result but the problem is can i have better solution for this? I can iterate the list once and swap first occurence of numberToBeMovedOnTop with first element, second occurence with numberToBeMovedOnTop with second element and so on. But can this be done with some inbuilt c# function without iterating twice in the list?