ProfileGroupSettingsCollection.Add(ProfileGroupSettings) Méthode

Définition

Ajoute un ProfileGroupSettings objet à la collection.

public:
 void Add(System::Web::Configuration::ProfileGroupSettings ^ group);
public void Add(System.Web.Configuration.ProfileGroupSettings group);
member this.Add : System.Web.Configuration.ProfileGroupSettings -> unit
Public Sub Add (group As ProfileGroupSettings)

Paramètres

group
ProfileGroupSettings

Objet ProfileGroupSettings à ajouter à la collection.

Exceptions

L’objet ProfileGroupSettings à ajouter existe déjà dans la collection, ou la collection est en lecture seule.

Exemples

L’exemple de code suivant montre comment utiliser la Add méthode. Cet exemple de code fait partie d’un exemple plus grand fourni pour la ProfileSection classe.

// Add a new group.
ProfileGroupSettings newPropGroup = new ProfileGroupSettings("Forum");
profileSection.PropertySettings.GroupSettings.Add(newPropGroup);

// Add a new PropertySettings to the group.
ProfilePropertySettings newProp = new ProfilePropertySettings("AvatarImage");
newProp.Type = "System.String, System.dll";
newPropGroup.PropertySettings.Add(newProp);

// Remove a PropertySettings from the group.
newPropGroup.PropertySettings.Remove("AvatarImage");
newPropGroup.PropertySettings.RemoveAt(0);

// Clear all PropertySettings from the group.
newPropGroup.PropertySettings.Clear();
' Add a new group.
Dim newPropGroup As ProfileGroupSettings = new ProfileGroupSettings("Forum")
profileSection.PropertySettings.GroupSettings.Add(newPropGroup)

' Add a new PropertySettings to the group.
Dim newProp As ProfilePropertySettings = new ProfilePropertySettings("AvatarImage")
newProp.Type = "System.String, System.dll"
newPropGroup.PropertySettings.Add(newProp)

' Remove a PropertySettings from the group.
newPropGroup.PropertySettings.Remove("AvatarImage")
newPropGroup.PropertySettings.RemoveAt(0)

' Clear all PropertySettings from the group.
newPropGroup.PropertySettings.Clear()

Remarques

La collection ne doit pas déjà contenir d’objet ProfileGroupSettings portant le même nom.

S’applique à

Voir aussi