static void Main()
{
int[] array = { 1, 2, 3, 4, 5, 6, 7 };
MoveNumberArrayToEnd(array, 3);
}
static void MoveNumberArrayToEnd<T>(IList<T> arrayList, int num)
{
if (arrayList.Count == 0 || arrayList.Count < num)
{
throw new RankException();
}
var query = (from number in arrayList
orderby number descending
select number).Take(arrayList.Count - num).Concat(arrayList.Take(num));
query.ToList().ForEach(q => Console.WriteLine("{0}", q));
}
摘自 wh_go的專欄