Share via


TestConfigurationSection 类

提供对数据源配置数据的访问。

继承层次结构

System.Object
  System.Configuration.ConfigurationElement
    System.Configuration.ConfigurationSection
      Microsoft.VisualStudio.TestTools.UnitTesting.TestConfigurationSection

命名空间:  Microsoft.VisualStudio.TestTools.UnitTesting
程序集:  Microsoft.VisualStudio.QualityTools.UnitTestFramework(在 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 中)

语法

声明
Public NotInheritable Class TestConfigurationSection _
    Inherits ConfigurationSection
public sealed class TestConfigurationSection : ConfigurationSection
public ref class TestConfigurationSection sealed : public ConfigurationSection
[<Sealed>]
type TestConfigurationSection =  
    class
        inherit ConfigurationSection
    end
public final class TestConfigurationSection extends ConfigurationSection

TestConfigurationSection 类型公开以下成员。

构造函数

  名称 说明
公共方法 TestConfigurationSection 初始化 TestConfigurationSection 类的新实例。

页首

属性

  名称 说明
公共属性 CurrentConfiguration 获取对顶级 Configuration 实例的引用,该实例表示当前 ConfigurationElement 实例所属的配置层次结构。 (继承自 ConfigurationElement。)
公共属性 DataSources 获取 DataSourceElementCollection,它包含数据源配置信息。
公共属性 ElementInformation 获取包含 ConfigurationElement 对象的不可自定义的信息和功能的 ElementInformation 对象。 (继承自 ConfigurationElement。)
受保护的属性 ElementProperty 获取本身表示 ConfigurationElement 对象的 ConfigurationElementProperty 对象。 (继承自 ConfigurationElement。)
受保护的属性 EvaluationContext 获取 ConfigurationElement 对象的 ContextInformation 对象。 (继承自 ConfigurationElement。)
受保护的属性 Item[ConfigurationProperty] 获取或设置此配置元素的属性或特性。 (继承自 ConfigurationElement。)
受保护的属性 Item[String] 获取或设置此配置元素的属性、特性或子元素。 (继承自 ConfigurationElement。)
公共属性 LockAllAttributesExcept 获取被锁定的特性的集合。 (继承自 ConfigurationElement。)
公共属性 LockAllElementsExcept 获取被锁定的元素的集合。 (继承自 ConfigurationElement。)
公共属性 LockAttributes 获取被锁定的特性的集合。 (继承自 ConfigurationElement。)
公共属性 LockElements 获取被锁定的元素的集合。 (继承自 ConfigurationElement。)
公共属性 LockItem 获取或设置一个值,该值指示是否已锁定该元素。 (继承自 ConfigurationElement。)
受保护的属性 Properties 获取属性的集合。 (继承自 ConfigurationElement。)
公共属性 SectionInformation 获取一个 SectionInformation 对象,该对象包含 ConfigurationSection 对象的不可自定义的信息和功能。 (继承自 ConfigurationSection。)

页首

方法

  名称 说明
受保护的方法 DeserializeElement 读取配置文件中的 XML。 (继承自 ConfigurationElement。)
受保护的方法 DeserializeSection 基础结构。读取配置文件中的 XML。 (继承自 ConfigurationSection。)
公共方法 Equals 将当前的 ConfigurationElement 实例与指定的对象进行比较。 (继承自 ConfigurationElement。)
受保护的方法 Finalize 允许对象在“垃圾回收”回收之前尝试释放资源并执行其他清理操作。 (继承自 Object。)
公共方法 GetHashCode 获取一个唯一值,表示当前 ConfigurationElement 实例。 (继承自 ConfigurationElement。)
受保护的方法 GetRuntimeObject 在派生的类中重写时返回自定义对象。 (继承自 ConfigurationSection。)
受保护的方法 GetTransformedAssemblyString 返回指定程序集名称的转换版本。 (继承自 ConfigurationElement。)
受保护的方法 GetTransformedTypeString 返回指定类型名称的转换版本。 (继承自 ConfigurationElement。)
公共方法 GetType 获取当前实例的 Type。 (继承自 Object。)
受保护的方法 Init ConfigurationElement 对象设置为其初始状态。 (继承自 ConfigurationElement。)
受保护的方法 InitializeDefault 用于初始化 ConfigurationElement 对象的默认值集。 (继承自 ConfigurationElement。)
受保护的方法 IsModified 指示自上次在派生类中实现此配置元素时保存或加载以来是否对其进行过修改。 (继承自 ConfigurationSection。)
公共方法 IsReadOnly 获取一个值,该值指示 ConfigurationElement 对象是否为只读。 (继承自 ConfigurationElement。)
受保护的方法 ListErrors 将此 ConfigurationElement 对象以及所有子元素中无效属性的错误添加到传递的列表中。 (继承自 ConfigurationElement。)
受保护的方法 MemberwiseClone 创建当前 Object 的浅表副本。 (继承自 Object。)
受保护的方法 OnDeserializeUnrecognizedAttribute 获取一个值,该值指示反序列化过程中是否遇到未知特性。 (继承自 ConfigurationElement。)
受保护的方法 OnDeserializeUnrecognizedElement 获取一个值,该值指示反序列化过程中是否遇到未知元素。 (继承自 ConfigurationElement。)
受保护的方法 OnRequiredPropertyNotFound 未找到所需属性时引发异常。 (继承自 ConfigurationElement。)
受保护的方法 PostDeserialize 反序列化后调用。 (继承自 ConfigurationElement。)
受保护的方法 PreSerialize 序列化前调用。 (继承自 ConfigurationElement。)
受保护的方法 Reset 重置 ConfigurationElement 对象的内部状态,包括锁和属性集合。 (继承自 ConfigurationElement。)
受保护的方法 ResetModified 在派生类中实现时,将 IsModified 方法的值重置为 false。 (继承自 ConfigurationSection。)
受保护的方法 SerializeElement 当在派生类中实现后,将此配置元素的内容写入配置文件。 (继承自 ConfigurationElement。)
受保护的方法 SerializeSection 基础结构。创建一个包含 ConfigurationSection 对象的分离视图的 XML 字符串,作为单独的节写入到文件中。 (继承自 ConfigurationSection。)
受保护的方法 SerializeToXmlElement 当在派生类中实现后,将此配置元素的外部标记写入配置文件。 (继承自 ConfigurationElement。)
受保护的方法 SetPropertyValue 将属性设置为指定值。 (继承自 ConfigurationElement。)
受保护的方法 SetReadOnly 设置 ConfigurationElement 对象及所有子元素的 IsReadOnly 属性。 (继承自 ConfigurationElement。)
受保护的方法 ShouldSerializeElementInTargetVersion 指示在为 .NET Framework 的指定目标版本序列化配置对象层次结构时,是否应序列化指定元素。 (继承自 ConfigurationSection。)
受保护的方法 ShouldSerializePropertyInTargetVersion 指示在为指定目标版本的 .NET Framework 序列化配置对象层次结构时,是否应序列化指定属性。 (继承自 ConfigurationSection。)
受保护的方法 ShouldSerializeSectionInTargetVersion 指示在为指定目标版本的 .NET Framework 序列化配置对象层次结构时,是否应序列化当前的 ConfigurationSection 实例。 (继承自 ConfigurationSection。)
公共方法 ToString 返回表示当前对象的字符串。 (继承自 Object。)
受保护的方法 Unmerge 修改 ConfigurationElement 对象以移除所有将不被保存的值。 (继承自 ConfigurationElement。)

页首

线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。

请参见

参考

Microsoft.VisualStudio.TestTools.UnitTesting 命名空间

其他资源

演练:使用配置文件定义数据源