The SynCommons unit has been enhanced:
- new low-level RTTI functions for handling record types:
RecordSave, RecordSaveLength, RecordLoad;
TDynArray object, which is a wrapper around any dynamic
TDynArray, you can access any dynamic array (like
TIntegerDynArray = array of integer) using
properties and methods, e.g.
Count, Add, Insert, Delete, Clear, IndexOf,
Find, Sort and some new methods like
SaveTo which allow fast binary serialization
of any dynamic array, even containing strings or records - a
CreateOrderedIndex method is also available to create individual
index according to the dynamic array content. You can also serialize the array
content into JSON, if you wish.
What I like with dynamic arrays is that they are reference-counted, don't
Create/try..finally...Free code, and are well handled by
the Delphi compiler.
They are no replacement to a
TCollection nor a
TList (which are the standard and efficient way of storing
class instances), but they are very handy way of having a list of content or a
dictionary at hand, with no class nor properties definition.
You can look at them like Python's list, tuples (via records handling) and
Find method), in pure Delphi. Our new methods
(about searching and serialization) allow most usage of those script-level
structures in your Delphi code.