Exemple #1
0
            public SortedList(List <int> list, SortingStrategy sortingStrategy)
            {
                if (sortingStrategy == null || list == null)
                {
                    throw new ArgumentNullException();
                }

                _list            = list;
                _sortingStrategy = sortingStrategy;
            }
Exemple #2
0
        static void Main(string[] args)
        {
            var list = CreateLongList();

            SortingStrategy sortedStrategy = new SortingStrategy();

            sortedStrategy.SortingAlgorithm = new SelectionSort();
            sortedStrategy.List             = new List <int>(list);
            sortedStrategy.Sort();

            sortedStrategy.SortingAlgorithm = new QuickSort();
            sortedStrategy.List             = new List <int>(list);
            sortedStrategy.Sort();
        }