/// <summary>
 /// Determines the index of a specific <see cref="ToolLinkItem"/> in the current instance.
 /// </summary>
 /// <param name="item">The <see cref="ToolLinkItem"/> to locate in the current instance.</param>
 /// <returns>The index of value if found in the current instance; otherwise, -1.</returns>
 public int IndexOf(ToolLinkItem item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     return(_links.IndexOf(item));
 }
 /// <summary>
 /// Determines whether a <see cref="ToolLinkItem"/> is in the collection.
 /// </summary>
 /// <param name="item">The <see cref="ToolLinkItem"/> to locate in the collection. The element to locate can be a null reference.</param>
 /// <returns>true if value is found in the collection; otherwise, false.</returns>
 public bool Contains(ToolLinkItem item)
 {
     if (item == null)
     {
         return(false);
     }
     return(_links.Contains(item));
 }
        /// <summary>
        /// Inserts a <see cref="ToolLinkItem"/> to the collection at the specified position.
        /// </summary>
        /// <param name="index">The zero-based index at which value should be inserted.</param>
        /// <param name="item">The <see cref="ToolLinkItem"/> to insert into the Collection.</param>
        public void Insert(int index, ToolLinkItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            _links.Insert(index, item);
        }
        private void AddTreeCustomLink(string editorID, ControlCollection nodes, ToolLinkItem link)
        {
            TreeNode newNode = new TreeNode();

            newNode.Link = string.Format("javascript:HTB_InsertCustomLink('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", editorID, ClientID, link.Address, link.Text, link.Anchor, link.Target, link.Tooltip);
            newNode.Text = link.Text;
            nodes.Add(newNode);
            foreach (ToolLinkItem li in link.Links)
            {
                AddTreeCustomLink(editorID, newNode.Nodes, li);
            }
        }
        /// <summary>
        /// Removes the first occurrence of a specific <see cref="ToolLinkItem"/> from the collection.
        /// </summary>
        /// <param name="item">The <see cref="ToolLinkItem"/> to remove from the collection.</param>
        public void Remove(ToolLinkItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            int index = IndexOf(item);

            if (index >= 0)
            {
                RemoveAt(index);
            }
        }