Exemplo n.º 1
0
        public void PerformCollectionDemonstration() //In den verschiedenen Klassen wird erklärt um welche Art von Collection es sich handelt und was deren Vor-und Nachteile sind.
        {
            Console.WriteLine("HashSet?");
            if (!string.IsNullOrEmpty(Console.ReadLine()))
            {
                Hashset.PerformHashSet();                                                            //aus dem "Generic" Namespace
            }
            Console.WriteLine("Queue?");
            if (!string.IsNullOrEmpty(Console.ReadLine()))
            {
                Queues.PerformQueue();                                              //aus dem "Generic" Namespace
            }
            Console.WriteLine("Stack?");
            if (!string.IsNullOrEmpty(Console.ReadLine()))
            {
                Stacks.PerformStack();                                              //aus dem "Generic" Namespace
            }
            Console.WriteLine("List?");
            if (!string.IsNullOrEmpty(Console.ReadLine()))
            {
                List.PerformLists();                                                //aus dem "Generic" Namespace
            }
            Console.WriteLine("LinkedList?");
            if (!string.IsNullOrEmpty(Console.ReadLine()))
            {
                LinkedList.PerformLinkedList();                                             //aus dem "Generic" Namespace
            }
            Console.WriteLine("Dictionary?");
            if (!string.IsNullOrEmpty(Console.ReadLine()))
            {
                Dictionary.PerformDictionaryOperations();                                               //aus dem "Generic" Namespace
            }
            Console.WriteLine("ListDictionary?");
            if (!string.IsNullOrEmpty(Console.ReadLine()))
            {
                ListDictionary.PerformListDictionary();                                             //aus dem "Specialized" Namespace
            }
            Console.WriteLine("HybridDictionary?");
            if (!string.IsNullOrEmpty(Console.ReadLine()))
            {
                HybridCollection.PerformHybridDictionary();                                             //aus dem "Specialized" Namespace
            }
            Console.WriteLine("ObservableCollection?");
            if (!string.IsNullOrEmpty(Console.ReadLine()))
            {
                ObservableCollection.PerformObservableCollection();                                             //aus dem "ObjectModel" Namespace
            }
            Console.WriteLine("BlockingCollecion?");
            if (!string.IsNullOrEmpty(Console.ReadLine()))
            {
                BlockingCollection.PerformBlockingCollection();                                             //aus dem "Concurrent" Namespace
            }
            //Mittlerweile wurden fast alle "Specialized" Collection in "Generic" Collections übersetzt und umbenannt, jedoch gibt es Ausnahmen

            //!ACHTUNG! Es ist sehr wichtig anzumerken, dass der Usecase(= Der Problemfall) der wichtigste Faktor für die Performance und eignung  einer Collection ist. Wählt also eine Collection aus die eurem Usecase entsprechen und nicht eine die nur eine etwas schnellere ausleserate hat
            //Eine schnelle Collection die falsch benutzt wird ist langsamer als eine langsamere Collection die passend benutzt wird.
        }