mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Add RemoveSwap to ValueList (#4093)
This commit is contained in:
@@ -510,4 +510,16 @@ public struct ValueList<T> : IEnumerable<T>
|
||||
_index = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="CollectionExtensions"/>
|
||||
/// </summary>
|
||||
public T RemoveSwap(int index)
|
||||
{
|
||||
var old = this[index];
|
||||
var replacement = this[Count - 1];
|
||||
this[index] = replacement;
|
||||
RemoveAt(Count - 1);
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user