Tommi Prami 130 Posted November 14, 2023 (edited) Hello, I tried to port Generics.Colllections code to using Spting4D collections instead. I got the "raised exception class EInvalidCast with message '"TMyRecord" is not a class type.'" exception, are the records at all supported, or I am doing something wrong. Code somethin g like that. FRecordCache.Add(LKEyString, LMyRecord); Created this way: FRecordCache:= TCollections.CreateDictionary<string, TMyRecord>([doOwnsValues]) Never mind, it was the doOwnsValues 😄 Edited November 14, 2023 by Tommi Prami Share this post Link to post
David Heffernan 2347 Posted November 14, 2023 Owns values, means "collection is going to call free on every vamue when it is no longer held in the list". Which implies it needs to be an instance of a class. A record is not. 1 Share this post Link to post
mvanrijnen 123 Posted November 14, 2023 litlle bit offtopic, just curious, but what would be the (big) advantage of using Spring4D for collections instead of the "Built In" generics/collections from Delphi?,. Share this post Link to post
David Heffernan 2347 Posted November 14, 2023 48 minutes ago, mvanrijnen said: but what would be the (big) advantage of using Spring4D for collections instead of the "Built In" generics/collections from Delphi? waiting for @Stefan Glienke to show up and answer this 1 Share this post Link to post
Stefan Glienke 2009 Posted November 14, 2023 More features, better performance, fewer bugs (and if there are any not having to wait for the Delphi version that fixes them), less binary code bloat. 1 2 Share this post Link to post
Rollo62 538 Posted November 14, 2023 (edited) 11 minutes ago, David Heffernan said: waiting for @Stefan Glienke to show up and answer this Here he is, himself https://www.youtube.com/watch?v=izI0Vah2CRs&t=3s accompanied by Nick Hodges https://www.google.com/search?client=firefox-b-d&q=spring4d+tutorial#fpstate=ive&vld=cid:910b8dff,vid:j9qvJiDz7ME,st:0 Edited November 14, 2023 by Rollo62 1 Share this post Link to post
Rollo62 538 Posted November 14, 2023 1 minute ago, Stefan Glienke said: More features, better performance, fewer bugs (and if there are any not having to wait for the Delphi version that fixes them), less binary code bloat. Sorry, I was a millisecond too late 1 Share this post Link to post
David Heffernan 2347 Posted November 14, 2023 I wrote my own set of collections years ago to escape from the bugs in the RTL collections, but I suspect there aren't so many these days Share this post Link to post