Condividi tramite


ProfileGroupSettings.Name Proprietà

Definizione

Ottiene o imposta il nome del gruppo di oggetti ProfilePropertySettings contenuto dall'oggetto.

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

Valore della proprietà

String

Stringa contenente il nome del gruppo di oggetti ProfilePropertySettings contenuto dall'oggetto. Il valore predefinito è una stringa vuota ("").

Attributi

Esempio

Nell'esempio di codice riportato di seguito viene illustrato come utilizzare la proprietà Name. Questo esempio di codice fa parte di un esempio più ampio fornito per la 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

Commenti

Il nome del gruppo deve essere univoco all'interno di una ProfileGroupSettingsCollection raccolta; in caso contrario, viene generata un'eccezione quando il file di configurazione viene salvato.

Si applica a

Vedi anche