Esempio n. 1
0
        public BinaryTreeCollection <T> AsReadOnly()
        {
            var readOnlyTree = new BinaryTreeCollection <T>();

            foreach (var node in this)
            {
                readOnlyTree.Add(node);
            }

            readOnlyTree.IsReadOnly = true;
            return(readOnlyTree);
        }
Esempio n. 2
0
        internal static void Main(string[] args)
        {
            var    tree    = new BinaryTreeCollection <int>();
            Random numbers = new Random();

            for (int i = 0; i < 5 * Math.Pow(10, 5); i++)
            {
                int current = numbers.Next(0, 10000);
                if (!tree.Contains(current))
                {
                    tree.Add(current);
                }
            }

            foreach (var element in tree)
            {
                Console.WriteLine(element);
            }

            Console.ReadKey();
        }