static void Main(string[] args)
        {
            Printer printer = new Printer();

            //printer.Execute();
            printer.TestDelegate();

            //*****************************************************************************************

            Calculator    calculator    = new Calculator();
            NewCalculator newCalculator = new NewCalculator();

            //calculator.PrintResult(10, 20, newCalculator.SetSum);

            //calculator.PrintResult(10, 20, calculator.MultiplyTwoNumbers);

            //*****************************************************************************************

            List <int> grades = new List <int>()
            {
                100, 85, 97, 61, 55, 89
            };
            IEnumerable <int> result = GradeChecker.CheckGrades(grades, GradeChecker.GreaterThanSeventy);

            foreach (int grade in result)
            {
                Console.WriteLine(grade);
            }

            //*****************************************************************************************

            MovieLibrary movieLibrary = new MovieLibrary();
            List <Movie> movies       = movieLibrary.GetMovies();

            List <Movie> hourAndAHalfMovieRunTime = movies.FindAll(m => m.runTime > 90);

            foreach (var movie in hourAndAHalfMovieRunTime)
            {
                Console.WriteLine(movie.title);
            }

            //*****************************************************************************************

            //The Departed, Inception, The Dark Knight

            var ninetyMinuteMovies = movies.Where(m => m.runTime >= 90); //The Departed, The Dark Knight

            var moviesSorted = ninetyMinuteMovies.OrderBy(m => m.title); //The Dark Knight, The Departed

            var movieTitles = moviesSorted.Select(m => m.title);         //"The Dark Knight", "The Departed"
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Calculator calculator = new Calculator();

            calculator.PrintResult(10, 20, calculator.AddTwoNumbers);

            calculator.PrintResult(10, 20, calculator.MultiplyTwoNumbers);

            //*****************************************************************************************

            List <int> grades = new List <int>()
            {
                100, 85, 97, 61, 55, 89
            };
            IEnumerable <int> result = GradeChecker.CheckGrades(grades, GradeChecker.LessThanEighty);

            foreach (int grade in result)
            {
                Console.WriteLine(grade);
            }

            //*****************************************************************************************

            MovieLibrary movieLibrary             = new MovieLibrary();
            List <Movie> movies                   = movieLibrary.GetMovies();
            List <Movie> hourAndAHalfMovieRunTime = movies.FindAll(m => m.runTime > 90);

            foreach (var movie in hourAndAHalfMovieRunTime)
            {
                Console.WriteLine(movie.title);
            }

            var ninetyMinuteMovies        = movies.Where(m => m.runTime >= 90);
            var ninentyMinuteMoviesSorted = ninetyMinuteMovies.OrderBy(m => m.title);

            //string name = "mike";
            //var printer = PrintResult;

            //printer();
        }