The Labs \ Source Viewer \ SSCLI \ System.Diagnostics \ TraceSection

  1. //------------------------------------------------------------------------------
  2. // <copyright file="TraceSection.cs" company="Microsoft Corporation">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. using System.Configuration;
  16. namespace System.Diagnostics
  17. {
  18.     internal class TraceSection : ConfigurationElement
  19.     {
  20.         private static readonly ConfigurationPropertyCollection _properties;
  21.         private static readonly ConfigurationProperty _propListeners = new ConfigurationProperty("listeners", typeof(ListenerElementsCollection), new ListenerElementsCollection(), ConfigurationPropertyOptions.None);
  22.         private static readonly ConfigurationProperty _propAutoFlush = new ConfigurationProperty("autoflush", typeof(bool), false, ConfigurationPropertyOptions.None);
  23.         private static readonly ConfigurationProperty _propIndentSize = new ConfigurationProperty("indentsize", typeof(int), 4, ConfigurationPropertyOptions.None);
  24.         private static readonly ConfigurationProperty _propUseGlobalLock = new ConfigurationProperty("useGlobalLock", typeof(bool), true, ConfigurationPropertyOptions.None);
  25.        
  26.         static TraceSection()
  27.         {
  28.             _properties = new ConfigurationPropertyCollection();
  29.             _properties.Add(_propListeners);
  30.             _properties.Add(_propAutoFlush);
  31.             _properties.Add(_propIndentSize);
  32.             _properties.Add(_propUseGlobalLock);
  33.         }
  34.        
  35.         [ConfigurationProperty("autoflush", DefaultValue = false)]
  36.         public bool AutoFlush {
  37.             get { return (bool)this[_propAutoFlush]; }
  38.         }
  39.        
  40.         [ConfigurationProperty("indentsize", DefaultValue = 4)]
  41.         public int IndentSize {
  42.             get { return (int)this[_propIndentSize]; }
  43.         }
  44.        
  45.         [ConfigurationProperty("listeners")]
  46.         public ListenerElementsCollection Listeners {
  47.             get { return (ListenerElementsCollection)this[_propListeners]; }
  48.         }
  49.        
  50.         [ConfigurationProperty("useGlobalLock", DefaultValue = true)]
  51.         public bool UseGlobalLock {
  52.             get { return (bool)this[_propUseGlobalLock]; }
  53.         }
  54.        
  55.         protected override ConfigurationPropertyCollection Properties {
  56.             get { return _properties; }
  57.         }
  58.     }
  59. }

Developer Fusion