語言

ProfilePropertySettings.ReadOnly 屬性

定義

取得或設定一個值,用以判斷動態產生 ProfileCommon 類別中相關屬性是否為唯讀。

public:
 property bool ReadOnly { bool get(); void set(bool value); };
[System.Configuration.ConfigurationProperty("readOnly", DefaultValue=false)]
public bool ReadOnly { get; set; }
[<System.Configuration.ConfigurationProperty("readOnly", DefaultValue=false)>]
member this.ReadOnly : bool with get, set
Public Property ReadOnly As Boolean

屬性值

true 如果類別中 ProfileCommon 相關的屬性是唯讀;否則, false。 預設值為 false。

屬性

範例

以下程式碼範例說明如何使用該 ReadOnly 屬性。 此程式碼範例是本類別更大範例 ProfileSection 的一部分。

// Get the current ReadOnly property value.
Console.WriteLine(
    "Current ReadOnly value: '{0}'", profilePropertySettings.ReadOnly);

// Set the ReadOnly property to true.
profilePropertySettings.ReadOnly = true;
' Get the current ReadOnly property value.
Console.WriteLine( _
    "Current ReadOnly value: '{0}'", profilePropertySettings.ReadOnly)

' Set the ReadOnly property to true.
profilePropertySettings.ReadOnly = true

備註

執行時,ASP.NET 編譯系統會根據設定檔區段中指定的 profile 資訊產生一個稱為 ProfileCommon的類別,該類別由 衍生而 ProfileBase來。 這個類別允許你存取並修改個別使用者設定檔的數值。

ProfileCommon類別定義基於設定檔該properties節子節中定義profile的屬性。 你為類別實例 ProfilePropertySettings 指定的屬性值,將用來定義類別中 ProfileCommon 相關的屬性。

適用於

另請參閱