Share via


Struct.create(Object[]) Method

Definition

Creates a struct from a container that is obtained from a prior call to Struct.pack.

public:
 static Microsoft::Dynamics::Ax::Xpp::Struct ^ create(cli::array <System::Object ^> ^ _container);
public static Microsoft.Dynamics.Ax.Xpp.Struct create (object[] _container);
static member create : obj[] -> Microsoft.Dynamics.Ax.Xpp.Struct
Public Shared Function create (_container As Object()) As Struct

Parameters

_container
Object[]

A container that contains the packed struct.

Returns

A struct equal to the one that was packed into the specified container.

Remarks

If the struct contains objects, these objects must have an unpack method that is called to re-establish their internal state from the container.

The following example creates a struct with two items in it (name and age), and then adds values to the items. The struct is packed into a container, and this container is then unpacked to create a new struct.

{  
    container packedStruct;  
    Struct s1, s = new Struct ("str name; int age"); 
    s.value ("name", "Jane Dow");  
    s.value ("age", 34); 
    // Struct is packed into a container 
    packedStruct = s.pack();  
    // A new struct is created from the container 
    s1 = Struct::create(packedStruct); 
    // Both structs have the same contents 
    print s.toString();  
    print s1.toString();  
    pause;  
}

Applies to