public ISettingsSection CreateSection(string name)
        {
            Debug.Assert(name != null);
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            var section = new SettingsSection(name);

            lock (lockObj)
                sections.Add(section);
            return(section);
        }
示例#2
0
        public ISettingsSection GetOrCreateSection(Guid guid)
        {
            var name = guid.ToString();
            ISettingsSection section;

            if (sections.TryGetValue(name, out section))
            {
                return(section);
            }

            section        = new SettingsSection(name);
            sections[name] = section;
            return(section);
        }
        public ISettingsSection GetOrCreateSection(string name)
        {
            Debug.Assert(name != null);
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            var section = sections.FirstOrDefault(a => StringComparer.Ordinal.Equals(name, a.Name));

            if (section != null)
            {
                return(section);
            }
            sections.Add(section = new SettingsSection(name));
            return(section);
        }
示例#4
0
        public ISettingsSection GetOrCreateSection(Guid guid)
        {
            if (guid == Guid.Empty)
            {
                throw new ArgumentOutOfRangeException(nameof(guid));
            }

            var name = guid.ToString();
            ISettingsSection section;

            if (sections.TryGetValue(name, out section))
            {
                return(section);
            }

            section        = new SettingsSection(name);
            sections[name] = section;
            return(section);
        }
示例#5
0
        public ISettingsSection GetOrCreateSection(string name)
        {
            Debug.Assert(!(name is null));
            if (name is null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            ISettingsSection section;

            lock (lockObj) {
                section = sections.FirstOrDefault(a => StringComparer.Ordinal.Equals(name, a.Name));
                if (!(section is null))
                {
                    return(section);
                }
                sections.Add(section = new SettingsSection(name));
            }
            return(section);
        }