Share via


SetIterator Class

Definition

The SetIterator class allows you to iterate over the elements in a set.

public ref class SetIterator : Microsoft::Dynamics::Ax::Xpp::XppObjectBase
public class SetIterator : Microsoft.Dynamics.Ax.Xpp.XppObjectBase
type SetIterator = class
    inherit XppObjectBase
Public Class SetIterator
Inherits XppObjectBase
Inheritance
Microsoft.Dynamics.AX.KernelInterop.ProxyBase
SetIterator

Remarks

Set iterators may be viewed as pointers into the sets over which they iterate. Functionality is available to start the iteration, to determine whether more elements are available, and to fetch the element pointed to by the iterator. Newly created set iterators are positioned at the first element in the set. The order in which the elements occur during iteration is defined not by the sequence in which the elements are inserted, but by the ordering of the elements. Elements with lower values appear before elements with higher values. The usual ordering for the types is used. If the constituent elements are objects; however, the addresses of the objects are used to supply the ordering. No specific ordering may consequently be inferred. The addresses of the objects are transient by nature. It is best practice to use the class instead of the SetIterator class. This avoids problems if you are accessing the set on one tier with an iterator on another tier. Set iterators and the sets over which they iterate must be on the same client/server side. If you use SetIterator and code is marked as Called from, it is possible that the set and the iterator will end up on different tiers, and the code will fail. If you use SetEnumerator, the enumerator is automatically created on the same tier as the set. Also, to move to the next item in a set, you must explicitly call the more and next methods if you are using a set iterator. If you use SetEnumerator, you only have to call moveNext method.

The following example creates a set of integers and then adds four values to it. It then iterates through the set that is printing out information about each set element.

    Set s1 = new Set (Types::Integer); 
    int theElement; 
    SetIterator it; 
    ; 
    // Add some elements. 
    s1.add(3); 
    s1.add(4); 
    s1.add(13); 
    s1.add(1); 
    // Start a traversal of the elements in the set. 
    it = new SetIterator(s1); 
    // Prints "(begin)[1]". 
    print it.toString(); 
    // The elements are fetched in the order: 1, 3, 4, 13. 
    while (it.more()) 
    { 
        theElement = it.value(); 
        print theElement; 
         // Fetch the next element. 
        it.next(); 
    } 
    pause; 
}

Constructors

SetIterator()
SetIterator(Set)

Fields

kernelClass (Inherited from XppObjectBase)

Properties

AxClassId

Methods

__shouldCallNew(Type) (Inherited from XppObjectBase)
addXppProxyReference(Type, Object) (Inherited from XppObjectBase)
Begin()

Moves the iterator to the start of the set.

Call(String, Object[], Type[], Object[]) (Inherited from XppObjectBase)
cancelTimeOut(Int32) (Inherited from XppObjectBase)
createKernelClass(Object[], Type[], Object[]) (Inherited from XppObjectBase)
Definitionstring()

Returns a textual representation of the type of the iterator.

Delete()

Removes the element that is pointed to by the iterator of the set.

End()

Moves the iterator past the last element in the set.

equal(XppObjectBase) (Inherited from XppObjectBase)
finalize() (Inherited from XppObjectBase)
GetIntPtr() (Inherited from XppObjectBase)
GetKernelInstanceUniqueId() (Inherited from XppObjectBase)
getTimeOutTimerHandle() (Inherited from XppObjectBase)
getXppProxyReference(Type) (Inherited from XppObjectBase)
handle()
IsManagedValid() (Inherited from XppObjectBase)
kernelhandle()
KernelInstanceDisposed() (Inherited from XppObjectBase)
MakeReflectionCall(String, Object[]) (Inherited from XppObjectBase)
More()

Determines whether the iterator denotes a valid set element.

newmethod() (Inherited from XppObjectBase)
Next()

Moves the iterator to the next element.

notify() (Inherited from XppObjectBase)
notifyAll() (Inherited from XppObjectBase)
objectOnServer()
Obsolete.
(Inherited from XppObjectBase)
setTimeOut(String, Int32, Boolean)
Obsolete.
(Inherited from XppObjectBase)
setTimeOut(String, Int32)
Obsolete.
(Inherited from XppObjectBase)
ToString()

Returns a textual representation of the current element in the set that is pointed to by the iterator.

usageCount() (Inherited from XppObjectBase)
Value()

Retrieves the value that the iterator is pointing to.

VerifyKernelClass() (Inherited from XppObjectBase)
wait() (Inherited from XppObjectBase)
Xml() (Inherited from XppObjectBase)
Xml(Int32) (Inherited from XppObjectBase)

Applies to