6.0.0
6.0.0
Breaking changes.
Closed issues:
- Deep copy: add native fallbacks for objects in js/py
- Expand DeepCopy logic to mutable collections that contain primitives
- Add a flag for DeepCopyPropertiesTo that enabled to omit static props
Improve DynamicObj
deep copy methods and refactor into a separate CopyUtils
class for reuse:
The following types/classes can be (recursively) deep copied now:
-
Basic F# types (
bool
,byte
,sbyte
,int16
,uint16
,int
,uint
,int64
,uint64
,nativeint
,unativeint
,float
,float32
,char
,string
,unit
,decimal
) -
ResizeArrays
andDictionaries
containing any combination of basic F# types -
Dictionaries
containingDynamicObj
as keys or values in any combination withDynamicObj
or basic F# types as keys or values -
array<DynamicObj>
,list<DynamicObj>
,ResizeArray<DynamicObj>
: These collections of DynamicObj are copied as a new collection with recursively deep copied elements. -
System.ICloneable
: If the property implementsICloneable
, theClone()
method is called on the property. -
DynamicObj
(and derived classes): properties that are themselvesDynamicObj
instances are deep copied recursively.
if a derived class has static properties (e.g. instance properties), these can be copied as dynamic properties on the new instance or ignored.
Note on Classes that inherit from DynamicObj
:
Classes that inherit from DynamicObj will match the DynamicObj
typecheck if they do not implement ICloneable
.
The deep copied instances will be cast to DynamicObj
with deep copied dynamic properties. Staic/instance properties can be copied as dynamic properties on the new instance or be ignored.
It should be possible to 'recover' the original type by checking if the needed properties exist as dynamic properties,
and then passing them to the class constructor if needed.
Full release notes: https://github.com/CSBiology/DynamicObj/blob/main/RELEASE_NOTES.md
Full Changelog: 5.0.0...6.0.0