ProfileInfoCollection.Add Method (ProfileInfo)


Adds the specified ProfileInfo object to the collection.

Namespace:   System.Web.Profile
Assembly:  System.Web (in System.Web.dll)

public void Add(
	ProfileInfo profileInfo


Type: System.Web.Profile.ProfileInfo

A ProfileInfo object to add to the collection.

Exception Condition

The collection is read-only.


A ProfileInfo object with the same UserName value as profileInfo already exists in the collection.


profileInfo is null.


The UserName property of profileInfo is null.

The Add method is commonly used by profile-provider implementers to populate a ProfileInfoCollection to return from the GetAllProfiles, GetAllInactiveProfiles, FindProfilesByUserName, or FindInactiveProfilesByUserName method of the ProfileProvider abstract class.

For an example of a ProfileProvider implementation that creates a ProfileInfoCollection for user profiles in a data store, see Implementing a Profile Provider.

.NET Framework
Available since 2.0
Return to top