1 //------------------------------------------------------------------------------
2 // <copyright file="TraceSection.cs" company="Microsoft Corporation">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //------------------------------------------------------------------------------
8 using System.Configuration;
10 namespace System.Diagnostics {
11 internal class TraceSection : ConfigurationElement {
12 private static readonly ConfigurationPropertyCollection _properties;
13 private static readonly ConfigurationProperty _propListeners = new ConfigurationProperty("listeners", typeof(ListenerElementsCollection), new ListenerElementsCollection(), ConfigurationPropertyOptions.None);
14 private static readonly ConfigurationProperty _propAutoFlush = new ConfigurationProperty("autoflush", typeof(bool), false, ConfigurationPropertyOptions.None);
15 private static readonly ConfigurationProperty _propIndentSize = new ConfigurationProperty("indentsize", typeof(int), 4, ConfigurationPropertyOptions.None);
16 private static readonly ConfigurationProperty _propUseGlobalLock = new ConfigurationProperty("useGlobalLock", typeof(bool), true, ConfigurationPropertyOptions.None);
18 static TraceSection() {
19 _properties = new ConfigurationPropertyCollection();
20 _properties.Add(_propListeners);
21 _properties.Add(_propAutoFlush);
22 _properties.Add(_propIndentSize);
23 _properties.Add(_propUseGlobalLock);
26 [ConfigurationProperty( "autoflush", DefaultValue=false )]
27 public bool AutoFlush {
29 return (bool) this[_propAutoFlush];
33 [ConfigurationProperty( "indentsize", DefaultValue=4 )]
34 public int IndentSize {
36 return (int) this[_propIndentSize];
40 [ConfigurationProperty( "listeners" )]
41 public ListenerElementsCollection Listeners {
43 return (ListenerElementsCollection) this[_propListeners];
47 [ConfigurationProperty( "useGlobalLock", DefaultValue = true)]
48 public bool UseGlobalLock {
50 return (bool) this[_propUseGlobalLock];
54 protected override ConfigurationPropertyCollection Properties {