4 using System.Collections.Generic;
6 namespace SiliconStudio.Core.Extensions
18 public static void SwapRemove<T>(
this IList<T> list, T item)
20 int index = list.IndexOf(item);
24 list.SwapRemoveAt(index);
32 public static void SwapRemoveAt<T>(
this IList<T> list,
int index)
34 if (index < 0 || index >= list.Count)
throw new ArgumentOutOfRangeException(
"index");
36 if (index < list.Count - 1)
38 list[index] = list[list.Count - 1];
41 list.RemoveAt(list.Count - 1);
An extension class for various types of collection.