mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Merge pull request #1459 from disarray2077/patch-2
Add `GetAndRemoveStrict` to `List<T>`
This commit is contained in:
commit
b886f3d3c3
1 changed files with 13 additions and 0 deletions
|
@ -812,6 +812,19 @@ namespace System.Collections
|
|||
return .Err;
|
||||
}
|
||||
|
||||
public Result<T> GetAndRemoveStrict(T item)
|
||||
{
|
||||
int index = IndexOfStrict(item);
|
||||
if (index >= 0)
|
||||
{
|
||||
T val = mItems[index];
|
||||
RemoveAt(index);
|
||||
return val;
|
||||
}
|
||||
|
||||
return .Err;
|
||||
}
|
||||
|
||||
public Result<T> GetAndRemoveAlt<TAlt>(TAlt item) where TAlt : IHashable where bool : operator T == TAlt
|
||||
{
|
||||
int index = IndexOfAlt(item);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue