Share via


SecurityElementCollection.GetEnumerator Method

Gets an System.Collections.IEnumerator that can iterate through the SecurityElementCollection.

Namespace: Microsoft.Web.Services2.Security
Assembly: Microsoft.Web.Services2 (in microsoft.web.services2.dll)

Usage

'Usage
Dim returnValue As IEnumerator
Dim securityElementCollection1 As SecurityElementCollection
returnValue = securityElementCollection1.GetEnumerator()

Syntax

'Declaration
Public NotOverridable Function GetEnumerator() As IEnumerator
public sealed IEnumerator GetEnumerator();
public: IEnumerator^ GetEnumerator();
public final IEnumerator GetEnumerator();
public final function GetEnumerator() : IEnumerator;

Return Value

An System.Collections.IEnumerator that iterates through the SecurityElementCollection.

Remarks

Enumerators only allow reading the data in the collection. Enumerators cannot be used to modify the underlying collection.

An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying or deleting elements, the enumerator is irrecoverably invalidated.

The enumerator 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 could 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.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Longhorn, and Windows 2000

Target Platforms

Windows 2000, Windows 2000 Server, Windows 2000 Advanced Server, Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Longhorn, Pocket PC, Windows CE, Smart Phone

See Also

Reference

SecurityElementCollection Class
Microsoft.Web.Services2.Security Namespace

Other Resources

SecurityElementCollection Members