共用方式為


ProfileSection.Inherits 屬性

定義

取得或設定衍生自 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 配置檔案屬性概觀

適用於

另請參閱