public T AddChildNode <T>(T child, Position position) where T : XmlPortNode { switch (position) { case Position.FirstWithinContainer: Container.Insert(Index + 1, child); break; case Position.LastWithinContainer: var lastIndex = Descendants.Any() ? Descendants.Last().Index : Index; Container.Insert(lastIndex + 1, child); break; } return(child); }
public bool HasChild(T value) { return(Descendants.Any(vertex => Equals(vertex.Value, value))); }