Archive.archiveAssociativeArrayKey

Archives an associative array key.

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
archiveAssociativeArrayKey
(
string key
,
void delegate
()
dg
)

Parameters

key string

the key associated with the key

dg void delegate
()

a callback that performs the actual archiving of the key

Examples

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

auto archive = new XmlArchive!();

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

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

See Also

archiveAssociativeArray archiveAssociativeArrayValue

Meta