MachineSettingsSection.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / SMDiagnostics / System / ServiceModel / Diagnostics / MachineSettingsSection.cs / 1305376 / MachineSettingsSection.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.ServiceModel.Configuration 
{
    using System.Configuration; 
 
    internal class MachineSettingsSection : ConfigurationSection
    { 
        static bool enableLoggingKnownPii;
        static bool hasInitialized = false;
        static object syncRoot = new object();
 
        const string enableLoggingKnownPiiKey = "enableLoggingKnownPii";
        ConfigurationPropertyCollection properties; 
 
        protected override ConfigurationPropertyCollection Properties
        { 
            get
            {
                if (this.properties == null)
                { 
                    ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
                    properties.Add(new ConfigurationProperty(MachineSettingsSection.enableLoggingKnownPiiKey, typeof(System.Boolean), false, null, null, System.Configuration.ConfigurationPropertyOptions.None)); 
                    this.properties = properties; 
                }
                return this.properties; 
            }
        }

        public static bool EnableLoggingKnownPii 
        {
            get 
            { 
                if (!hasInitialized)
                { 
                    lock (syncRoot)
                    {
                        if (!hasInitialized)
                        { 
                            MachineSettingsSection machineSettingsSection = (MachineSettingsSection)ConfigurationManager.GetSection("system.serviceModel/machineSettings");
                            enableLoggingKnownPii = (bool)machineSettingsSection[MachineSettingsSection.enableLoggingKnownPiiKey]; 
                            hasInitialized = true; 
                        }
                    } 
                }

                return enableLoggingKnownPii;
            } 
        }
    } 
} 

 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.ServiceModel.Configuration 
{
    using System.Configuration; 
 
    internal class MachineSettingsSection : ConfigurationSection
    { 
        static bool enableLoggingKnownPii;
        static bool hasInitialized = false;
        static object syncRoot = new object();
 
        const string enableLoggingKnownPiiKey = "enableLoggingKnownPii";
        ConfigurationPropertyCollection properties; 
 
        protected override ConfigurationPropertyCollection Properties
        { 
            get
            {
                if (this.properties == null)
                { 
                    ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
                    properties.Add(new ConfigurationProperty(MachineSettingsSection.enableLoggingKnownPiiKey, typeof(System.Boolean), false, null, null, System.Configuration.ConfigurationPropertyOptions.None)); 
                    this.properties = properties; 
                }
                return this.properties; 
            }
        }

        public static bool EnableLoggingKnownPii 
        {
            get 
            { 
                if (!hasInitialized)
                { 
                    lock (syncRoot)
                    {
                        if (!hasInitialized)
                        { 
                            MachineSettingsSection machineSettingsSection = (MachineSettingsSection)ConfigurationManager.GetSection("system.serviceModel/machineSettings");
                            enableLoggingKnownPii = (bool)machineSettingsSection[MachineSettingsSection.enableLoggingKnownPiiKey]; 
                            hasInitialized = true; 
                        }
                    } 
                }

                return enableLoggingKnownPii;
            } 
        }
    } 
} 

 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK