public ProfileSection(string name, int lineNumber = -1) : base(lineNumber)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("name");
            }

            if (Zongsoft.Common.StringExtension.ContainsCharacters(name, "/*?"))
            {
                throw new ArgumentException();
            }

            _name  = name.Trim();
            _items = new ProfileItemCollection(this);
        }
        protected ProfileItemViewBase(ProfileItemCollection items)
        {
            _items           = items ?? throw new ArgumentNullException(nameof(items));
            _innerDictionary = new Dictionary <string, T>(items.Count, StringComparer.OrdinalIgnoreCase);

            foreach (var item in items)
            {
                if (this.OnItemMatch(item))
                {
                    _innerDictionary.Add(this.GetKeyForItem((T)item), (T)item);
                }
            }

            items.CollectionChanged += Items_CollectionChanged;
        }
示例#3
0
        public ProfileSection(string name, int lineNumber = -1) : base(lineNumber)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (name.IndexOfAny(IllegalCharacters) >= 0)
            {
                throw new ArgumentException($"The specified '{name}' section name contains illegal characters.");
            }

            _name  = name.Trim();
            _items = new ProfileItemCollection(this);
        }
 public ProfileEntryCollection(ProfileItemCollection items) : base(items)
 {
 }
示例#5
0
 public ProfileSectionCollection(ProfileItemCollection items) : base(items)
 {
 }