Compartilhar via


ProfileGroupSettings.Name Propriedade

Definição

Obtém ou define o nome do grupo de objetos ProfilePropertySettings que este objeto contém.

public:
 property System::String ^ Name { System::String ^ get(); };
[System.Configuration.ConfigurationProperty("name", IsKey=true, IsRequired=true)]
public string Name { get; }
[<System.Configuration.ConfigurationProperty("name", IsKey=true, IsRequired=true)>]
member this.Name : string
Public ReadOnly Property Name As String

Valor da propriedade

Uma cadeia de caracteres que contém o nome do grupo de ProfilePropertySettings objetos que este objeto contém. O valor padrão é uma cadeia de caracteres vazia ("").

Atributos

Exemplos

O exemplo de código a seguir mostra como usar a Name propriedade . Este exemplo de código faz parte de um exemplo maior fornecido para a ProfileSection classe .

// Display all current ProfileGroupSettings.
Console.WriteLine("Current ProfileGroupSettings:");
int PGSCtr = 0;
foreach (ProfileGroupSettings propGroups in profileSection.PropertySettings.GroupSettings)
{
    Console.WriteLine("  {0}: ProfileGroupSetting '{1}'", ++PGSCtr,
        propGroups.Name);
    int PPSCtr = 0;
    foreach (ProfilePropertySettings props in propGroups.PropertySettings)
    {
        Console.WriteLine("    {0}: ProfilePropertySetting '{1}'", ++PPSCtr,
            props.Name);
    }
}
' Display all current ProfileGroupSettings.
Console.WriteLine("Current ProfileGroupSettings:")
Dim PGSCtr As Integer = 0
For Each propGroups As ProfileGroupSettings In profileSection.PropertySettings.GroupSettings
                    Console.WriteLine("  {0}: ProfileGroupSettings '{1}'", ++PGSCtr, _
        propGroups.Name)
    Dim PPSCtr As Integer = 0
    For Each props As ProfilePropertySettings In propGroups.PropertySettings
        Console.WriteLine("    {0}: ProfilePropertySetting '{1}'", ++PPSCtr, _
            props.Name)
    Next
Next

Comentários

O nome do grupo deve ser exclusivo dentro de uma ProfileGroupSettingsCollection coleção; caso contrário, uma exceção é gerada quando o arquivo de configuração é salvo.

Aplica-se a

Confira também