From Xojo Documentation


Dictionary.Clone() As Dictionary

New in 2019r2

Supported for all project types and targets.

Performs a shallow clone of the Dictionary, resulting in a new Dictionary that can be manipulated independently of the first. A shallow clone means that if a Dictionary Value or Key refers to a class instance, its contents are not also cloned.

Sample Code

Clone a dictionary and then change the original:

Var d1 As New Dictionary
d1.Value("Test") = "Hello, World!"

Dim d2 As Dictionary
d2 = d1.Clone

d1.Value("Test") = "Changed!"

// d2.Value("Test") is still "Hello, World!"