Beispiel #1
0
        /// <summary>
        /// Gets the parent of a specified type. This method goes back
        /// to all parent and returns the first parent of the type T or null if no parent were found.
        /// </summary>
        /// <typeparam name="T">Type of the parent</typeparam>
        /// <returns>a valid reference to the parent T or null if no parent of this type</returns>
        public T GetParent <T>() where T : CsBase
        {
            CsBase parent = Parent;

            while (parent != null && !(parent is T))
            {
                parent = parent.Parent;
            }
            return((T)parent);
        }
Beispiel #2
0
 /// <summary>
 /// Removes the specified inner container from this container
 /// </summary>
 /// <remarks>
 /// The Parent property of the innerContainer is set to null.
 /// </remarks>
 /// <param name="innerCs">The inner container.</param>
 public void Remove(CsBase innerCs)
 {
     innerCs.Parent = null;
     _items.Remove(innerCs);
 }
Beispiel #3
0
 /// <summary>
 /// Adds the specified inner container to this container.
 /// </summary>
 /// <remarks>
 /// The Parent property of the innerContainer is set to this container.
 /// </remarks>
 /// <param name="innerCs">The inner container.</param>
 public void Add(CsBase innerCs)
 {
     innerCs.Parent = this;
     _items.Add(innerCs);
 }
 public IReadOnlyList <T> GetList(CsBase container)
 {
     if (list is { Invalid : true })
Beispiel #5
0
 /// <summary>
 /// Removes the specified inner container from this container
 /// </summary>
 /// <remarks>
 /// The Parent property of the innerContainer is set to null.
 /// </remarks>
 /// <param name="innerCs">The inner container.</param>
 public void Remove(CsBase innerCs)
 {
     Items.Remove(innerCs);
 }
Beispiel #6
0
 /// <summary>
 /// Adds the specified inner container to this container.
 /// </summary>
 /// <remarks>
 /// The Parent property of the innerContainer is set to this container.
 /// </remarks>
 /// <param name="innerCs">The inner container.</param>
 public void Add(CsBase innerCs)
 {
     Items.Add(innerCs);
 }
Beispiel #7
0
 public CsNamespace(CsBase parentContainer, string nameSpace)
 {
     Name   = nameSpace;
     Parent = parentContainer;
 }