/// <summary>
        /// Loads properties from the configuration sections
        /// specified in <see cref="ConfigSections"/> into <paramref name="properties"/>.
        /// </summary>
        /// <param name="properties">The <see cref="NameValueCollection"/> instance to be filled with properties.</param>
        protected virtual void LoadProperties(NameValueCollection properties)
        {
            string[] configSections = ConfigSections;
            if (_locations != null)
            {
                ValidateConfigSections(configSections);
                bool usingMultipleConfigSections = configSections.Length > 1;
                int  sectionNameIndex            = 0;
                foreach (IResource resource in _locations)
                {
                    #region Instrumentation

                    if (_log.IsDebugEnabled)
                    {
                        _log.Debug(string.Format(
                                       CultureInfo.InvariantCulture,
                                       "Loading configuration from '{0}'.", resource));
                    }

                    #endregion

                    string sectionName = configSections[sectionNameIndex];
                    if (resource is ConfigSectionResource)
                    {
                        ConfigurationReader.PopulateFromAppConfig(
                            properties, sectionName, _lastLocationOverrides);
                    }
                    else
                    {
                        if (resource.Exists)
                        {
                            ConfigurationReader.Read(
                                resource, sectionName, properties, _lastLocationOverrides);
                        }
                        else
                        {
                            string errorMessage = "Could not load configuration from " + resource;
                            if (_ignoreResourceNotFound)
                            {
                                #region Instrumentation

                                if (_log.IsWarnEnabled)
                                {
                                    _log.Warn(errorMessage);
                                }

                                #endregion
                            }
                            else
                            {
                                throw new ObjectInitializationException(errorMessage);
                            }
                        }
                    }
                    if (usingMultipleConfigSections)
                    {
                        ++sectionNameIndex;
                    }
                }
            }
            else
            {
                foreach (string sectionName in configSections)
                {
                    ConfigurationReader.PopulateFromAppConfig(
                        properties, sectionName, _lastLocationOverrides);
                }
            }
        }