mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 14:54:09 +02:00
Add GetAndRemoveStrict
to List<T>
This commit is contained in:
parent
4c5c89bab5
commit
dd7a84ef03
1 changed files with 13 additions and 0 deletions
|
@ -812,6 +812,19 @@ namespace System.Collections
|
||||||
return .Err;
|
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
|
public Result<T> GetAndRemoveAlt<TAlt>(TAlt item) where TAlt : IHashable where bool : operator T == TAlt
|
||||||
{
|
{
|
||||||
int index = IndexOfAlt(item);
|
int index = IndexOfAlt(item);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue