0

I'am staring to use the Spring4D Framework for Delphi because of its Collections methods that delivers interfaces and all sort of other cool stuff.

I was wondering If there is a Interface I can use, when I need a Dictionary with a Class and that Dictionary should free the classes. Lets say Tdictionary<String,TMyClass>. How can I get my interface to free up TMyClass when the Dictionary goes out of scope?

fisi-pjm
  • 378
  • 2
  • 16
  • https://stackoverflow.com/questions/48851664/spring4d-interface-based-collection-lifecycle I would close as a dupe, but, strike – David Heffernan Jun 07 '23 at 17:45
  • Hi David, Thanks for your great answer. Do you have a Working code Snippet for me? I tryed: Notifications := TCollections.CreateDictionary(DoOwnsValues); But Compiler says that there is no overloaded Function of CreateDictionary. – fisi-pjm Jun 12 '23 at 06:33
  • I'm sure you can read the source code for spring and work this out – David Heffernan Jun 12 '23 at 06:45
  • 1
    Thanks, like TTDictionaryOwnershipS suggested, it can take multiple values here. So I put it in square brackets and it Works: Notifications := TCollections.CreateDictionary([DoOwnsValues]); – fisi-pjm Jun 12 '23 at 06:54

0 Answers0