Share via


Set.difference(Set, Set) Method

Definition

Calculates and retrieves the set containing the elements from set1 that are not found in set2.

public:
 static Microsoft::Dynamics::Ax::Xpp::Set ^ difference(Microsoft::Dynamics::Ax::Xpp::Set ^ _set1, Microsoft::Dynamics::Ax::Xpp::Set ^ _set2);
public static Microsoft.Dynamics.Ax.Xpp.Set difference (Microsoft.Dynamics.Ax.Xpp.Set _set1, Microsoft.Dynamics.Ax.Xpp.Set _set2);
static member difference : Microsoft.Dynamics.Ax.Xpp.Set * Microsoft.Dynamics.Ax.Xpp.Set -> Microsoft.Dynamics.Ax.Xpp.Set
Public Shared Function difference (_set1 As Set, _set2 As Set) As Set

Parameters

_set1
Set

The set to check.

_set2
Set

The set to check.

Returns

Set

A set containing the elements from set1 that are not found in set2.

Remarks

The two sets to be compared must be of the same type.

The following example creates one set that contains the integers 1, 2, and 3, and one set that contains the integers 2 and 4. The difference method is used to create a set that contains the elements in the first set that are not in the second set (1 and 3).

{ 
    Set is = new Set (Types::Integer); 
    Set is2, is1 = new Set (Types::Integer); 
    ; 
    is.add(1); 
    is.add(2); 
    is.add(3); 
    is1.add(2); 
    is1.add(4); 
    is2 = Set::difference(is, is1); 
    // prints "{1, 3}" 
    print is2.toString(); 
    pause; 
}

Applies to