예제 #1
0
 public void Add(AbstractContainer containerToAdd)
 {
     if (Contains(containerToAdd.Name))
     {
         throw new ArgumentException($"Folder {Name} already contains folder with name {containerToAdd.Name}");
     }
     containerToAdd.Parent = this;
     _containers.Add(containerToAdd);
 }
예제 #2
0
        public void RemoveByName(string name)
        {
            AbstractContainer comp = GetChildOrDefault(name);

            if (comp == null)
            {
                throw new ArgumentException($"There is no container with name: {name}");
            }
            _containers.Remove(comp);
        }
예제 #3
0
 public void Remove(AbstractContainer container)
 {
     RemoveByName(container.Name);
 }