ProfileGroupSettings 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供对 group 配置文件节的子节的 profiles 编程访问。
public ref class ProfileGroupSettings sealed : System::Configuration::ConfigurationElement
public sealed class ProfileGroupSettings : System.Configuration.ConfigurationElement
type ProfileGroupSettings = class
inherit ConfigurationElement
Public NotInheritable Class ProfileGroupSettings
Inherits ConfigurationElement
- 继承
示例
下面的代码示例演示如何使用该 ProfileGroupSettings 类型。 该代码示例是 ProfileSection 类中的一个较大示例的一部分。
// Add a new group.
ProfileGroupSettings newPropGroup = new ProfileGroupSettings("Forum");
profileSection.PropertySettings.GroupSettings.Add(newPropGroup);
// Add a new PropertySettings to the group.
ProfilePropertySettings newProp = new ProfilePropertySettings("AvatarImage");
newProp.Type = "System.String, System.dll";
newPropGroup.PropertySettings.Add(newProp);
// Remove a PropertySettings from the group.
newPropGroup.PropertySettings.Remove("AvatarImage");
newPropGroup.PropertySettings.RemoveAt(0);
// Clear all PropertySettings from the group.
newPropGroup.PropertySettings.Clear();
' Add a new group.
Dim newPropGroup As ProfileGroupSettings = new ProfileGroupSettings("Forum")
profileSection.PropertySettings.GroupSettings.Add(newPropGroup)
' Add a new PropertySettings to the group.
Dim newProp As ProfilePropertySettings = new ProfilePropertySettings("AvatarImage")
newProp.Type = "System.String, System.dll"
newPropGroup.PropertySettings.Add(newProp)
' Remove a PropertySettings from the group.
newPropGroup.PropertySettings.Remove("AvatarImage")
newPropGroup.PropertySettings.RemoveAt(0)
' Clear all PropertySettings from the group.
newPropGroup.PropertySettings.Clear()
注解
该 ProfileGroupSettings 类提供了一种以编程方式创建、访问和修改添加到 group 配置文件节子节 profile 的属性组的方法。
配置文件 profile 的节指定用户配置文件的架构。 在运行时,ASP.NET 编译系统使用节中指定的 profile 信息来生成一 ProfileCommon个名为(派生自 ProfileBase)的类。 类ProfileCommon定义基于配置文件节的子节profile中properties定义的属性。 为每个用户配置文件创建此类的实例,可以通过属性访问代码 HttpContext.Profile 中的单个配置文件值。 有关添加到 ASP.NET 2.0 的配置文件功能的详细信息,请参阅 ASP.NET 配置文件属性概述。
构造函数
| 名称 | 说明 |
|---|---|
| ProfileGroupSettings(String) |
使用默认设置初始化类的新实例 ProfileGroupSettings 。 |