mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Use index-based removal of items
This commit is contained in:
@@ -303,13 +303,15 @@ namespace SabreTools.DatFiles
|
||||
#endif
|
||||
|
||||
// If the value doesn't exist in the key, return
|
||||
if (!list.Exists(i => i.Equals(value)))
|
||||
int removeIndex = list.FindIndex(i => i.Equals(value));
|
||||
if (removeIndex < 0)
|
||||
return false;
|
||||
|
||||
// Remove the statistics first
|
||||
DatStatistics.RemoveItemStatistics(value);
|
||||
|
||||
return list.Remove(value);
|
||||
list.RemoveAt(removeIndex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user