Skip to content

Expand DeepCopy logic to mutable collections that contain primitives #45

@kMutagene

Description

@kMutagene

e.g. ResizeArray<string> is not caught by any custom copy logic, and will be reference equal, leading to this:

#r "nuget: DynamicObj"
open DynamicObj

let r = new ResizeArray<string>(["1"; "2"])
let d1 = 
    DynamicObj()
    |> DynObj.withProperty "r" r

let d2 = d1.DeepCopyProperties() |> unbox<DynamicObj>

r.Add("3")

printfn "%A" d1?r // ["1"; "2"; "3"] 
printfn "%A" d2?r // ["1"; "2"; "3"] =(

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions