예제 #1
0
        static void Main(string[] args)
        {
            ThirdParty_Service thirdPartyService = new ThirdParty_Service();

            YourService yourService = new YourService(thirdPartyService);

            Parallel.For(1, 10, async i =>
            {
                MenuData menu = await yourService.GetMenuData(i.ToString());

                Console.WriteLine($"MenuId: {menu.MenuId}, Name: {menu.Name}");

                Console.WriteLine("======================================");
            });



            //Parallel.For(1, 5, async i =>
            //{
            //    IEnumerable<CategoryData> categories = await yourService.GetCategories(i.ToString());

            //    foreach (CategoryData item in categories)
            //    {
            //        Console.WriteLine($"MenuId: {item.MenuId}, Name: {item.Name}");
            //    }
            //    Console.WriteLine("======================================");
            //});


            Console.WriteLine("Hello World.");

            Console.ReadKey();
        }
예제 #2
0
 public YourService(ThirdParty_Service thirdPartyService)
 {
     _thirdPartyService = thirdPartyService;
 }