IADsCollection

The IADsCollection interface allows you to manage an arbitrary set of named data elements. Collections differ from arrays of elements in that individual items can be added or deleted without reordering the entire array.

Collection objects can represent one or more items that correspond persistent data, such as physical objects in the directory. All elements in a collection must be of the same type.

ADSI also exposes the IADsMembers and IADsContainer interfaces for manipulating two special cases of collection objects. IADsMembers is used for a collection of objects that share a common membership. An example of such objects are users that belong to a group. IADsContainer applies to a directory object that contains other objects. An example of this is a directory tree.

Inheritance: IEnumerator

Methods

  • Method

  • Description

  • Add()

  • Adds a named item to the collection.

  • GetEnumerator()

  • Gets an enumerator object for this collection object.

  • GetObject()

  • Gets an item of the collection.

  • Remove()

  • Removes the named item from this collection object.

Details

Add()

Adds a named item to the collection.

void Add(string itemName, object itemToAdd)

Parameters

  • itemName - Specifies the item name. The GetObject and Remove methods reference the item by this name.
  • itemToAdd - Specifies an object to be added to the collection.

GetEnumerator()

Gets an enumerator object for this collection object. The enumerator object implements the IEnumerator interface that can be used to enumerate objects in foreach loops.

IEnumerator GetEnumerator()

GetObject()

Gets an item of the collection.

object GetObject(string itemName)

Parameters

The itemName parameter specifies the name of the item. This is the same name passed to the Add method when the item is added to the collection.


Remove()

Removes the named item from this collection object.

void Remove(string itemToBeRemoved)

Parameters

The itemToBeRemoved parameter specifies the name of the item as it was specified by the Add method.


Requirements

Minimum required version: 2009.1

See also