/// <summary>
        /// Froms the XML node.
        /// </summary>
        /// <param name="treeCollection">The tree collection.</param>
        /// <param name="currentColl">The current coll.</param>
        /// <param name="xnode">The xnode.</param>
        /// <param name="readerDelegate">The reader delegate.</param>
        private static void FromXmlNode(TreeCollection <T> treeCollection, ref TreeItemCollection <T> currentColl, XmlNode xnode, TreeItemXmlReaderDelegate readerDelegate)
        {
            XmlNodeList xlist = xnode.SelectNodes("./TreeItem");

            for (int i = 0; i < xlist.Count; i++)
            {
                XmlNode currentNode = xlist[i];

                TreeItem <T> newItem = currentColl.Add(treeCollection.GlobalCollection.CreateFreeKey(), default(T));

                readerDelegate(ref newItem, currentNode);

                if (currentNode.ChildNodes.Count > 0)
                {
                    TreeItemCollection <T> itemColl = newItem.Subitems;
                    FromXmlNode(treeCollection, ref itemColl, xlist[i], readerDelegate);
                }
            }
        }
        /// <summary>
        /// Froms the XML.
        /// </summary>
        /// <param name="xdoc">The xdoc.</param>
        /// <param name="readerDelegate">The reader delegate.</param>
        /// <returns>TreeCollection&lt;T&gt;.</returns>
        public static TreeCollection <T> FromXml(XmlDocument xdoc, TreeItemXmlReaderDelegate readerDelegate)
        {
            XmlNodeList        xlist    = xdoc.SelectNodes("TreeCollection//TreeItem");
            TreeCollection <T> treeColl = new TreeCollection <T>(xlist.Count);

            xlist = xdoc.SelectNodes("TreeCollection/TreeItem");

            for (int i = 0; i < xlist.Count; i++)
            {
                XmlNode currentNode = xlist[i];

                TreeItem <T> newItem = treeColl.Items.Add(treeColl.GlobalCollection.CreateFreeKey(), default(T));

                readerDelegate(ref newItem, currentNode);

                if (currentNode.ChildNodes.Count > 0)
                {
                    TreeItemCollection <T> currentColl = treeColl.Items;
                    FromXmlNode(treeColl, ref currentColl, xlist[i], readerDelegate);
                }
            }
            return(treeColl);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TreeItemCollection{T}"/> class.
 /// </summary>
 /// <param name="ownerCollection">The owner collection.</param>
 /// <param name="parent">The parent.</param>
 internal TreeItemCollection(ref TreeCollection <T> ownerCollection, string parent)
     : this(ref ownerCollection, parent, new LightCollection <string>())
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TreeItemCollection{T}"/> class.
 /// </summary>
 /// <param name="ownerCollection">The owner collection.</param>
 /// <param name="parent">The parent.</param>
 /// <param name="items">The items.</param>
 internal TreeItemCollection(ref TreeCollection <T> ownerCollection, string parent, LightCollection <string> items)
 {
     _parent          = parent;
     _items           = new LightCollection <string>(items);
     _ownerCollection = ownerCollection;
 }