Archive.archiveAssociativeArrayValue

Archives an associative array value.

There are separate methods for archiving associative array keys and values because both the key and the value can be of arbitrary type and needs to be archived on its own.

interface Archive
void
archiveAssociativeArrayValue
(
string key
,
void delegate
()
dg
)

Parameters

key string

the key associated with the value

dg void delegate
()

a callback that performs the actual archiving of the value

Examples

int[string] arr = ["a"[] : 1, "b" : 2, "c" : 3];

auto archive = new XmlArchive!();
size_t i;

foreach(k, v ; arr)
{
    archive.archiveAssociativeArrayValue(to!(string)(i), {
        // archive the value
    });

    i++;
}

The foreach statement in the above example would most likely be executed in the callback passed to the archiveAssociativeArray method.

See Also

archiveAssociativeArray archiveAssociativeArrayKey

Meta