ProfilePropertySettings.DefaultValue 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定預設值,用於動態產生之 ProfileCommon
類別中的相關聯屬性。
public:
property System::String ^ DefaultValue { System::String ^ get(); void set(System::String ^ value); };
[System.Configuration.ConfigurationProperty("defaultValue", DefaultValue="")]
public string DefaultValue { get; set; }
[<System.Configuration.ConfigurationProperty("defaultValue", DefaultValue="")>]
member this.DefaultValue : string with get, set
Public Property DefaultValue As String
屬性值
字串,包含用於動態產生之 ProfileCommon
類別中相關聯屬性的預設值。 預設為空字串 ("")。
- 屬性
範例
下列程式碼範例示範如何使用 DefaultValue 屬性。 此程式碼範例是提供給 類別之較大範例的 ProfileSection 一部分。
// Get the current DefaultValue property value.
Console.WriteLine(
"Current DefaultValue value: '{0}'", profilePropertySettings.DefaultValue);
// Set the DefaultValue property to "March 16, 2004".
profilePropertySettings.DefaultValue = "March 16, 2004";
' Get the current DefaultValue property value.
Console.WriteLine( _
"Current DefaultValue value: '{0}'", profilePropertySettings.DefaultValue)
' Set the DefaultValue property to "March 16, 2004".
profilePropertySettings.DefaultValue = "March 16, 2004"
備註
在執行時間,ASP.NET 編譯系統會使用組態檔 區段中指定 profile
的資訊來產生名為 ProfileCommon
的類別,其衍生自 ProfileBase 。 類別可讓您存取和修改個別使用者設定檔的值。
類別 ProfileCommon
定義是以組態檔區段子區段中 profile
定義的 properties
屬性為基礎。 您為 類別實例 ProfilePropertySettings 指定的屬性值將用來定義 類別中的 ProfileCommon
相關聯屬性。
當個別使用者設定檔不包含 屬性的值時,預設值會當做相關聯 ProfileCommon
類別屬性的初始值。 DefaultValue如果屬性的序列化模式是二進位序列化) ,則屬性可以是字串值、xml 編碼值 (序列化模式為 XML 序列化) 或基底 64 編碼的二進位字串 (。
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應