コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: TreeVertex.cs プロジェクト: oparkerj/AdventOfCode
 public bool HasChild(T value)
 {
     return(Descendants.Any(vertex => Equals(vertex.Value, value)));
 }