ProfileGroupSettingsCollection.Add(ProfileGroupSettings) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Adiciona um ProfileGroupSettings objeto à coleção.
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)
Parâmetros
- group
- ProfileGroupSettings
Um ProfileGroupSettings objeto para adicionar à coleção.
Exceções
O ProfileGroupSettings objeto a adicionar já existe na coleção, ou a coleção é apenas de leitura.
Exemplos
O exemplo de código a seguir mostra como usar o Add método. Este exemplo de código faz parte de um exemplo maior fornecido para a 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()
Observações
A coleção não deve já conter um ProfileGroupSettings objeto com o mesmo nome.