Share via


AudienceCollection.GetEnumerator Method

Returns an enumerator that iterates through the AudienceCollection object.

Namespace:  Microsoft.Office.Server.Audience
Assembly:  Microsoft.Office.Server (in Microsoft.Office.Server.dll)

Syntax

'Declaration
Public Function GetEnumerator As IEnumerator
'Usage
Dim instance As AudienceCollection
Dim returnValue As IEnumerator

returnValue = instance.GetEnumerator()
public IEnumerator GetEnumerator()

Return Value

Type: System.Collections.IEnumerator
System.Collections.IEnumerator that represents an enumerator that iterates through the collection.

Remarks

The enumerator returned by GetEnumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.

See Also

Reference

AudienceCollection Class

AudienceCollection Members

Microsoft.Office.Server.Audience Namespace