语言

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

适用于

另请参阅