This project is read-only.
Project Description
Generic Base Classes that helps you to create complex tree structures without writing it again and again. Simply to use Like "var Node<Folder> folders;" or a bit mor complex like class City : TwigNode<Country, City, Street>


If you wanna use it, please goto the Sourcecode page and download the source.

Usage example for a tree like this:

--Country
     |
     +--City1
     |
     +--City2
     |
     +--City3
           |
           +--Street




    class Country : RootNode<Country, City>
    {
        // any of your own code here       
    }
    
    class City : TwigNode<Country, City, Street>
    {
        // any of your own code here       
    }

    class Street : LeafNode<City, Street>
    {
        // any of your own code here       
    }

    class Programm
    {
        void Main()
        {
            Country country = new Country();

            var city1 = new City(1);
            country.Children.Add(city1);
            
            var city2 = new City(2);
            country.Children.Add(city2);

            var city3 = new City(3);
            country.Children.Add(city3);

            var street = new Street();
            city3.Children.Add(street);

            Assert.IsTrue(city3.IsLastChild);

            Assert.IsTrue(city3.PeeviousSibling == city2);

            Assert.IsTrue(city3.Parent.FirstChild == city1);        

            Assert.IsTrue(country.Children[0].Children[0] == city1);        
        }
    }    

A bit more Infos about this classes on my Blog at http://www.porticle.de

Last edited Apr 21, 2010 at 11:46 PM by cjendro, version 8