请单击以进行评分并提供反馈
MSDN
MSDN Library
.NET 开发
.NET Framework
 Sections 属性
全部折叠/全部展开 全部折叠
此页面仅适用于
Microsoft Visual Studio 2008/.NET Framework 3.5

同时提供下列产品的其他版本:
.NET Framework 类库
ConfigurationSectionGroup..::.Sections 属性

更新:2007 年 11 月

获取一个 ConfigurationSectionCollection 对象,其中包含此 ConfigurationSectionGroup 对象中的所有 ConfigurationSection 对象。

命名空间:  System.Configuration
程序集:  System.Configuration(在 System.Configuration.dll 中)

Visual Basic(声明)
Public ReadOnly Property Sections As ConfigurationSectionCollection
Visual Basic (用法)
Dim instance As ConfigurationSectionGroup
Dim value As ConfigurationSectionCollection

value = instance.Sections
C#
public ConfigurationSectionCollection Sections { get; }
Visual C++
public:
property ConfigurationSectionCollection^ Sections {
    ConfigurationSectionCollection^ get ();
}
J#
/** @property */
public ConfigurationSectionCollection get_Sections()
JScript
public function get Sections () : ConfigurationSectionCollection

下面的代码示例演示如何访问 Sections 属性。

Visual Basic
Dim sectionCollection _
As ConfigurationSectionCollection = _
sectionGroup.Sections
Dim sectionName As String
For Each sectionName In sectionCollection.Keys
    Dim section As ConfigurationSection = _
    CType(sectionCollection( _
    sectionName), ConfigurationSection)
    Console.WriteLine((getSpacer() + _
    "Section Name:" + _
    section.SectionInformation.Name))
Next sectionName
C#
ConfigurationSectionCollection sectionCollection = 
    sectionGroup.Sections;
foreach (String sectionName in sectionCollection.Keys)
{
    ConfigurationSection section = 
        (ConfigurationSection)sectionCollection[sectionName];
    Console.WriteLine(getSpacer() + "Section Name:" 
        + section.SectionInformation.Name);
}

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

.NET Framework

受以下版本支持:3.5、3.0、2.0
社区内容   什么是社区内容?
添加新内容 RSS  批注
Processing
© 2009 Microsoft Corporation 版权所有。 保留所有权利 | 商标 | 隐私权声明
Page view tracker