共用方式為


ProfileGroupSettings.Name 屬性

定義

取得或設定這個物件所包含之 ProfilePropertySettings 物件群組的名稱。

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

屬性值

字串,包含這個物件所包含之 ProfilePropertySettings 物件群組的名稱。 預設值為空字串 ("")。

屬性

範例

下列程式碼範例示範如何使用 Name 屬性。 此程式碼範例是提供給 類別之較大範例的 ProfileSection 一部分。

// 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

備註

組名在集合中必須是唯一的 ProfileGroupSettingsCollection ,否則會在儲存組態檔時引發例外狀況。

適用於

另請參閱