Example #1
0
        public void StartTasks()
        {
            Task[]        tasks = new Task[UrlList.Count()];
            DownloadFiles feeds = new DownloadFiles();

            for (int i = 0; i < UrlList.Count(); i++)
            {
                int j = i;
                tasks[i] = Task.Factory.StartNew(() => { feeds.Download(UrlList[j], j); });
            }
            //Waits until all tasks to get completed
            Task.WaitAll(tasks);
        }
Example #2
0
        public void StartTasks()
        {
            Task[] tasks = new Task[UrlList.Count()];
            DownloadFiles feeds = new DownloadFiles();

            for (int i = 0; i < UrlList.Count(); i++)
            {
                int j = i;
                tasks[i] = Task.Factory.StartNew(() => { feeds.Download(UrlList[j], j); });

            }
            //Waits until all tasks to get completed
            Task.WaitAll(tasks);
        }