语言

ProfilePropertySettings.Name 属性

定义

获取或设置 ProfilePropertySettings 动态生成的 ProfileCommon 类中的对象名称和关联的属性。

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
[System.Configuration.ConfigurationProperty("name", IsKey=true, IsRequired=true)]
public string Name { get; set; }
[<System.Configuration.ConfigurationProperty("name", IsKey=true, IsRequired=true)>]
member this.Name : string with get, set
Public Property Name As String

属性值

包含对象名称的 ProfilePropertySettings 字符串。 默认值为 null。

属性

示例

下面的代码示例演示如何使用该 Name 属性。 该代码示例是 ProfileSection 类中的一个较大示例的一部分。

// Get the current Name property value.
Console.WriteLine(
    "Current Name value: '{0}'", profilePropertySettings.Name);

// Set the Name property to "LastAccessDate".
profilePropertySettings.Name = "LastAccessDate";
' Get the current Name property value.
Console.WriteLine( _
    "Current Name value: '{0}'", profilePropertySettings.Name)

' Set the Name property to "LastAccessDate".
profilePropertySettings.Name = "LastAccessDate"

注解

在运行时,ASP.NET 编译系统使用配置文件节中指定的 profile 信息来生成一 ProfileCommon个名为(派生自 ProfileBase)的类。 该类允许你访问和修改各个用户配置文件的值。

类ProfileCommon定义基于配置文件节的子节properties中profile定义的属性。 为类实例 ProfilePropertySettings 指定的属性值将用于定义类中的 ProfileCommon 关联属性。

适用于

另请参阅