Condividi tramite


ProfileGroupSettingsCollection.Add(ProfileGroupSettings) Metodo

Definizione

Aggiunge un oggetto ProfileGroupSettings alla raccolta.

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)

Parametri

group
ProfileGroupSettings

Oggetto ProfileGroupSettings da aggiungere alla raccolta.

Eccezioni

L'oggetto ProfileGroupSettings da aggiungere è già presente nell'insieme oppure l'insieme è in sola lettura.

Esempio

Nell'esempio di codice riportato di seguito viene illustrato come utilizzare il metodo Add. Questo esempio di codice fa parte di un esempio più grande fornito per 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()

Commenti

L'insieme non deve già contenere un ProfileGroupSettings oggetto con lo stesso nome.

Si applica a

Vedi anche