예제 #1
0
        // Get a configuration object, using a particular handler.
        // This is for internal use, to provide a fallback handler
        // if the section is not mentioned in "machine.default".
        internal static Object GetConfig
            (String sectionName, IConfigurationSectionHandler handler)
        {
            // Make sure that the configuration system is initialized.
            BuiltinConfigurationSystem system;

            lock (typeof(ConfigurationSettings))
            {
                if (configSystem != null)
                {
                    system = configSystem;
                }
                else if (configError != null)
                {
                    throw configError;
                }
                else
                {
                    configSystem = new BuiltinConfigurationSystem();
                    try
                    {
                        configSystem.Init();
                    }
                    catch (Exception e)
                    {
                        configError = e;
                        throw;
                    }
                    system = configSystem;
                }
            }

            // Look up the specified configuration item.
            return(system.GetConfig(sectionName, handler));
        }
	// Get a configuration object, using a particular handler.
	// This is for internal use, to provide a fallback handler
	// if the section is not mentioned in "machine.default".
	internal static Object GetConfig
				(String sectionName, IConfigurationSectionHandler handler)
			{
				// Make sure that the configuration system is initialized.
				BuiltinConfigurationSystem system;
				lock(typeof(ConfigurationSettings))
				{
					if(configSystem != null)
					{
						system = configSystem;
					}
					else if(configError != null)
					{
						throw configError;
					}
					else
					{
						configSystem = new BuiltinConfigurationSystem();
						try
						{
							configSystem.Init();
						}
						catch(Exception e)
						{
							configError = e;
							throw;
						}
						system = configSystem;
					}
				}

				// Look up the specified configuration item.
				return system.GetConfig(sectionName, handler);
			}