This is an example:
originalList is a list of objects
var subList = (originalList.Where(x => x.number < 0)).ToList();
originalList.RemoveAll(x => x.number < 0);
I will use the subList later.
In this example the originaList is iterated two times. This function is called billions of times and originalList is a large List
Is there a easy way to improve the performance?
One important thing: The value of number of the object can change between two calls of this function.