Class List

The List class stores a collection of variables, with each variable indexed by an integer. The items in the collection can be any valid VARIANT data subtype. It should be stressed that this class is not a SAFEARRAY. This class is also not a COM class, and as such cannot be created stand-alone.  It is an intrinsic class used by the other Active Channel Server classes.  Collections that are marked as class List are essentially just properties that return the address of an IDispatch interface that exposes the methods and properties of this class.  The methods and properties of this dispinterface are listed below.

Dispinterface IList

The methods and properties of a List object are only accessible as a dispinterface.  (via a standard IDispatch COM interface.)

Methods and Properties

Name Return Type Parameter
Count Integer (VT_I4) (property)
Item VARIANT (VT_XXXX) Integer index (VT_I4)
Add void VARIANT item (VT_XXXX)
Remove void Integer index (VT_I4)
_NewEnum IEnumVariant* (VT_DISPATCH) (property)

Synopsis

The Count property returns how many items are in the list.

The Item method returns an item from the list

The Add method adds an item to the list

The Remove method removes an item from the list

The _NewEnum property returns an IEnumVariant interface. This object can then be used to enumerate the items in the List collection. For most Automation compliant programming and scripting languages, enumeration of the collection is handled behind the scenes.

Examples

' Windows Scripting Host Runtime using VBScript

Set IDispChannel = CreateObject("push.channel")
Set IDispList = IDispChannel.Subchannels
Set IDispItem = CreateObject("push.item")
call IDispList.Add(IDispItem)

' delete objects with DeleteOnRefresh = TRUE
For i = 1 to IDispList.Count-1
  if IDispList.Item(i).DeleteOnRefresh then
    IDispList.Delete(i)
Next

The "things" in the collection can be enumerated automatically in the normal way:

for each item in IList
 …
next

© 1997-1998 Microsoft Corporation. All rights reserved.