/// <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); }
/// <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); }
/// <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 })
/// <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); }
/// <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); }
public CsNamespace(CsBase parentContainer, string nameSpace) { Name = nameSpace; Parent = parentContainer; }