예제 #1
0
파일: Program.cs 프로젝트: iac-nyc/C-Sharp
        public static void Main(string[] args)
        {
            var searchParameters = new BirdSearch
            {
                Size    = "Medium",
                Country = "United States",
                Colors  = new List <string> {
                    "White", "Brown", "Black"
                },
                Page     = 0,
                PageSize = 5
            };

            Console.WriteLine("Type any key to begin search");

            var birds = BirdsRepository.LoadBirds();

            while (Console.ReadKey().keyChar != 'q')
            {
                Console.WriteLine($"Page: (searchParameters.Page)");

                birds.Search(searchParameters).ToList().ForEach(b =>
                {
                    Console.WriteLine($"Common Name:  (b.CommonName)");
                });
                searchParameters.Page++;
            }
        }
예제 #2
0
        static async Task Main(string[] args)
        {
            var temp = new List <Bird>
            {
                new Bird {
                    Name = "Зяблик", Description = "описание зяблика"
                },
                new Bird {
                    Name = "Ворон", Description = "описание ворона"
                },
                new Bird {
                    Name = "Воробей", Description = "описание воробья"
                },
                new Bird {
                    Name = "Рябчик", Description = "описание рябчика"
                },
            };

            var config          = new Configuration();
            var birdsRepository = new BirdsRepository(config);

            var searchQuery  = new BirdsSearchQuery();
            var searchResult = await birdsRepository.SearchAsync(searchQuery, CancellationToken.None)
                               .ConfigureAwait(false);

            foreach (var bird in searchResult)
            {
                Console.WriteLine(bird.Name);
            }
        }