2 using System.Collections.Generic;
5 using System.Threading.Tasks;
7 using System.Diagnostics.Contracts;
11 static class IListExtensions
13 public static void Swap<T>(
19 Contract.Requires(list != null);
20 Contract.Requires(firstIndex >= 0 && firstIndex < list.Count);
21 Contract.Requires(secondIndex >= 0 && secondIndex < list.Count);
22 if (firstIndex == secondIndex)
26 T temp = list[firstIndex];
27 list[firstIndex] = list[secondIndex];
28 list[secondIndex] = temp;