Array.create(Object[]) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates an array from the container that is obtained from a previous call to the Array.pack method.
public:
static Microsoft::Dynamics::Ax::Xpp::Array ^ create(cli::array <System::Object ^> ^ _container);
public static Microsoft.Dynamics.Ax.Xpp.Array create (object[] _container);
static member create : obj[] -> Microsoft.Dynamics.Ax.Xpp.Array
Public Shared Function create (_container As Object()) As Array
Parameters
- _container
- Object[]
A container that is created by using the Array.pack method. The container is unpacked to create an array.
Returns
An array that holds the contents of the specified container.
Remarks
If the values in the array are objects, the objects must have an Array.unpack method that is called to reestablish their internal state from a container.
The following example creates an array and adds two sets to it. The array is packed and then used to create a new array.
{
Array myArray;
Array newArray;
container packedArray;
Set set1 = new Set(Types::Integer);
Set set2 = new Set(Types::Integer);
int i;
int j;
myArray = new Array(Types::Class);
// Add some values to the set1 and set2
for (i = 0; i < 10; i++)
{
set1.add(i);
j = i+3;
set2.add(j);
}
// Add set1 and set2 to myArray
myArray.value(1, set1);
myArray.value(2, set2);
// Pack the myArray into a container
packedArray = myArray.pack();
// Create a new array from the container
if(packedArray != connull())
{
newArray = Array::create(packedArray);
}
// Test that newArray has same contents as myArray
print newArray.definitionString();
print newArray.toString();
pause;
}