Add RemoveSwap to ValueList (#4093)

This commit is contained in:
metalgearsloth
2023-05-31 13:50:57 +10:00
committed by GitHub
parent 5d67041a0c
commit 467914e115

View File

@@ -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;
}
}