Delphi generics TObjectList does have the Extract(const Value: T): T; method. But what about Extract(Index: Integer). I a lot of the cases the index is known and it makes no sense to search again and again for the pointers.

Delphi generics TObjectList does have the Extract(const Value: T): T; method. But what about Extract(Index: Integer). I a lot of the cases the index is known and it makes no sense to search again and again for the pointers.




Comments

  1. Fabian S. Biehn IList from Spring has the same issue so far as I can tell

    ReplyDelete
  2. While I agree having an overloaded Extract would be nice, the basic Items[Index] properties should do what you are asking for... or am I missing something?

    ReplyDelete
  3. Yes you are missing something. Extract removes the object from a list with OwnsObjects set to True, but does not destroy it. That's the entire modus operandi for Extract. That's the difference between Remove and Extract.

    ReplyDelete

Post a Comment