MembershipUserCollection.GetEnumerator Method

Definition

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

C#
public System.Collections.IEnumerator GetEnumerator();

Returns

An IEnumerator for the entire MembershipUserCollection.

Implements

Examples

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

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

Remarks

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

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also