1
0
Fork 0
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:
disarray2077 2022-02-18 11:53:17 -03:00 committed by GitHub
parent 4c5c89bab5
commit dd7a84ef03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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