コード例 #1
0
 internal void addBranch(CustomPartTreeItem customPartTreeItem)
 {
     CustomPartTreeItem[] newChildren = new CustomPartTreeItem[children.Count() + 1];
     for (int i = 0; i < children.Count(); i++)
     {
         newChildren[i] = children[i];
     }
     newChildren[children.Count()] = customPartTreeItem;
     children = newChildren;
 }
コード例 #2
0
 /// <summary>
 /// Im betting on the part tree not changing all that often.
 /// Otherwise a list might be better.
 /// </summary>
 /// <param name="index"></param>
 internal void removeBranch(int index)
 {
     CustomPartTreeItem[] newChildren = new CustomPartTreeItem[children.Count() - 1];
     for (int i = 0; i < index; i++) {
         newChildren[i] = children[i];
     } 
     for (int i = index+1; i < children.Count(); i++)
     {
         newChildren[i-1] = children[i];
     }
     children = newChildren;
 }