Xojo.Core.Dictionary.Clone

From Xojo Documentation

Method

Xojo.Core.Dictionary.Clone() As Xojo.Core.Dictionary

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 Xojo.Core.Dictionary
d1.Value("Test") = "Hello, World!"

Var d2 As Xojo.Core.Dictionary
d2 = d1.Clone

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

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