Set.pack Method [AX 2012]
Serializes the current instance of the Set class.
The container created by this method contains 3 elements before the first element from the set:
-
A version number for the container
-
An integer that identifies the data type of the set elements
-
The number of elements in the set
If the keys or the values are objects, the pack method is called on each object to create a subcontainer.
You can create a new set from the resulting container by using the Set::create method.
The following example creates a set of 10 integers, packs it into a container, and then creates a new set with contents identical to the original one.
{
Set is1, is = new Set (Types::Integer);
int i;
container packedSet;
;
// Create a set containing the first 10 integers.
for (i = 1; i <= 10; i++)
{
is.add(i);
}
// Pack it down in a container...
packedSet = is.pack();
// ... and restore it
is1 = Set::create(packedSet);
print is1.toString();
pause;
}
Community Additions
ADD
Show: