Share via


AudienceSiteCollection.GetEnumerator method

Returns an enumerator that can iterate through the AudienceSiteCollection object.

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

Syntax

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

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

Return value

Type: System.Collections.IEnumerator
System.Collections.IEnumerator. Object that represents an enumerator that can be used to iterate through the collection.

Implements

IEnumerable.GetEnumerator()

Remarks

The enumerator returned by the GetEnumerator method 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 ensure 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

AudienceSiteCollection class

AudienceSiteCollection members

Microsoft.Office.Server.Audience namespace