1 \feffusing System.Collections.Generic;
2 using System.Diagnostics.Contracts;
6 static class IListExtensions
8 public static void Swap<T>(
14 Contract.Requires(list != null);
15 Contract.Requires(firstIndex >= 0 && firstIndex < list.Count);
16 Contract.Requires(secondIndex >= 0 && secondIndex < list.Count);
17 if (firstIndex == secondIndex)
21 T temp = list[firstIndex];
22 list[firstIndex] = list[secondIndex];
23 list[secondIndex] = temp;