T
Tony Johansson
Hello!
Assume I want to delete an object in a collection.
I don't have the object that should be removed but I have the fields where I
can loop through
the collection until I find the right object and when I find the right
object I delete it and do a break from the loop.
Now to my question what gives the best performace of these two alternatives.
1. Do what I do know loop through the collection until I find the right
object and then delete it and then do a break from the looping.
2. Use a linq query do find the object to be deletet and the delete this
object directly without looping.
//Tony
Assume I want to delete an object in a collection.
I don't have the object that should be removed but I have the fields where I
can loop through
the collection until I find the right object and when I find the right
object I delete it and do a break from the loop.
Now to my question what gives the best performace of these two alternatives.
1. Do what I do know loop through the collection until I find the right
object and then delete it and then do a break from the looping.
2. Use a linq query do find the object to be deletet and the delete this
object directly without looping.
//Tony