ProfileSection.Inherits 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定一個由 ProfileBase衍生出的自訂型別的型別參考。
public:
property System::String ^ Inherits { System::String ^ get(); void set(System::String ^ value); };
[System.Configuration.ConfigurationProperty("inherits", DefaultValue="")]
public string Inherits { get; set; }
[<System.Configuration.ConfigurationProperty("inherits", DefaultValue="")>]
member this.Inherits : string with get, set
Public Property Inherits As String
屬性值
有效的型別參考,或空字串(“”)。 預設值是空字串。
- 屬性
範例
以下程式碼範例說明如何使用該 Inherits 屬性。 此程式碼範例是本類別更大範例 ProfileSection 的一部分。
// Get the current Inherits property value.
Console.WriteLine(
"Current Inherits value: '{0}'", profileSection.Inherits);
// Set the Inherits property to
// "CustomProfiles.MyCustomProfile, CustomProfiles.dll".
profileSection.Inherits = "CustomProfiles.MyCustomProfile, CustomProfiles.dll";
' Get the current Inherits property value.
Console.WriteLine( _
"Current Inherits value: '{0}'", profileSection.Inherits)
' Set the Inherits property to
' "CustomProfiles.MyCustomProfile, CustomProfiles.dll".
profileSection.Inherits = "CustomProfiles.MyCustomProfile, CustomProfiles.dll"
備註
執行時,ASP.NET 編譯系統會利用配置區段中指定的 profile 資訊產生一個稱為 ProfileCommon的類別,該類別由 衍生出來 ProfileBase。 為了自訂此類別所提供的資訊,你可以將屬性設定Inherits為你所建立的類型名稱,該類型源自 ProfileBase,編譯系統會使用此自訂類型作為 的基底類別。ProfileCommon
備註
如果你在屬性中 Inherits 提供型別參考,你可以在自訂型別中定義那些未用 property 元素定義的屬性。
欲了解更多關於 ASP.NET 2.0新增設定檔功能,請參見 ASP.NET 設定檔屬性總覽。