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 配置文件属性概述

适用于

另请参阅