25 lines
621 B
C#
25 lines
621 B
C#
namespace Quadtree
|
|
{
|
|
internal static class ListExtensions
|
|
{
|
|
public static bool RemoveUnordered<T>(this List<T> list, T obj)
|
|
{
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
if (list[i].Equals(obj))
|
|
{
|
|
list.RemoveUnorderedAt(i);
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static void RemoveUnorderedAt<T>(this List<T> list, int index)
|
|
{
|
|
list[index] = list[list.Count - 1];
|
|
list.RemoveAt(list.Count - 1);
|
|
}
|
|
}
|
|
}
|