ProfilePropertySettings 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
這個 ProfilePropertySettings 類別提供一種程式化的方式,可以存取並修改設定檔的該 profiles 區段。 無法繼承這個類別。
public ref class ProfilePropertySettings sealed : System::Configuration::ConfigurationElement
public sealed class ProfilePropertySettings : System.Configuration.ConfigurationElement
type ProfilePropertySettings = class
inherit ConfigurationElement
Public NotInheritable Class ProfilePropertySettings
Inherits ConfigurationElement
- 繼承
範例
以下程式碼範例說明如何存取 PropertySettings 包含一組 ProfilePropertySettings 物件的屬性值。 此程式碼範例是本類別更大範例 ProfileSection 的一部分。
// Display all current root ProfilePropertySettings.
Console.WriteLine("Current Root ProfilePropertySettings:");
int rootPPSCtr = 0;
foreach (ProfilePropertySettings rootPPS in profileSection.PropertySettings)
{
Console.WriteLine(" {0}: ProfilePropertySetting '{1}'", ++rootPPSCtr,
rootPPS.Name);
}
' Display all current root ProfilePropertySettings.
Console.WriteLine("Current Root ProfilePropertySettings:")
Dim rootPPSCtr As Integer = 0
For Each rootPPS As ProfilePropertySettings In profileSection.PropertySettings
Console.WriteLine(" {0}: ProfilePropertySetting '{1}'", ++rootPPSCtr, _
rootPPS.Name)
Next
備註
此ProfilePropertySettings類別提供一種程式化方式,可以程式化地建立、存取及修改設定檔該區段子節profile中新增properties的個別屬性定義。
設定檔的 profile 部分指定了使用者設定檔的結構。 執行時,ASP.NET 編譯系統會利用該 profile 區段指定的資訊產生一個稱為 ProfileCommon的類別,該類別由 衍生而 ProfileBase來。
ProfileCommon類別定義基於設定檔該profile節子節中定義properties的屬性。 每個使用者設定檔都會建立一個這個類別的實例,你可以透過這個 HttpContext.Profile 屬性存取程式碼中的各個設定檔值。 欲了解更多關於剖面屬性的資訊,請參閱 ASP.NET 剖面屬性概覽。 欲了解更多關於 ASP.NET 2.0新增設定檔功能,請參見 ASP.NET 設定檔屬性總覽。
建構函式
| 名稱 | Description |
|---|---|
| ProfilePropertySettings(String, Boolean, SerializationMode, String, String, String, Boolean, String) |
初始化一個以指定名稱和設定的新類別實例 ProfilePropertySettings 。 |
| ProfilePropertySettings(String) |
初始化一個以指定名稱的新 ProfilePropertySettings 類別實例。 |