Share via


Struct.merge(Struct, Struct) Method

Definition

Combines two structs to create a new struct.

public:
 static Microsoft::Dynamics::Ax::Xpp::Struct ^ merge(Microsoft::Dynamics::Ax::Xpp::Struct ^ _struct1, Microsoft::Dynamics::Ax::Xpp::Struct ^ _struct2);
public static Microsoft.Dynamics.Ax.Xpp.Struct merge (Microsoft.Dynamics.Ax.Xpp.Struct _struct1, Microsoft.Dynamics.Ax.Xpp.Struct _struct2);
static member merge : Microsoft.Dynamics.Ax.Xpp.Struct * Microsoft.Dynamics.Ax.Xpp.Struct -> Microsoft.Dynamics.Ax.Xpp.Struct
Public Shared Function merge (_struct1 As Struct, _struct2 As Struct) As Struct

Parameters

_struct1
Struct

The struct that will be added to the end of the first struct to create a new struct.

_struct2
Struct

The struct that will be added to the end of the first struct to create a new struct.

Returns

The new struct.

Remarks

struct2 is added to the end of struct1. This means that the order of the items in the new struct will be: all the items in struct1, arranged in alphabetical order of the item names, followed by all the items in struct2, arranged in alphabetical order of the item names. If both structs contain an item with the same name, only the item from the first struct will be included.

The following example creates two structs called person and address, and then merges them into a new struct called allInfo.

{ 
    container packedStruct; 
    Struct person = new Struct ("str name; int age"); 
    Struct address = new Struct ("str street; str city; str country"); 
    Struct allInfo; 
    person.value ("name", "Jane Dow"); 
    person.value ("age", 34); 
    address.value ("street", "Downing street 10"); 
    address.value ("country", "Great Britain"); 
    address.value ("city", " London"); 
    allInfo = Struct::merge(person, address); 
    print allInfo.toString(); 
    pause; 
}

Applies to