MembershipUserCollection.GetEnumerator Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets an enumerator that can iterate through the membership user collection.

Namespace:   System.Web.Security
Assembly:  System.Web.ApplicationServices (in System.Web.ApplicationServices.dll)

public IEnumerator GetEnumerator()

Enumerators only allow reading the data in the collection. Enumerators cannot be used to modify the underlying collection. For more information, see IEnumerator.

The following code example uses the IEnumerator returned from the GetEnumerator method to iterate through a MembershipUserCollection.

public void ListUsers(MembershipUserCollection users)
  foreach (MembershipUser u in users)
    Response.Write(u.UserName + "<br />");

.NET Framework
Available since 2.0
Return to top