Exemple #1
0
        private Company[] GetCompanies()
        {
            List <string[]> comPar = HTMLOperator.GetCompanyParameters(webAddressMain);

            Company[] companies = new Company[comPar.Count];
            for (int i = 0; i < comPar.Count; i++)
            {
                string[] pair = comPar[i];
                companies[i] = new Company(pair[0], pair[1]);
            }
            return(companies);
        }
Exemple #2
0
        private async Task <Company[]> GetCompaniesAsync()
        {
            List <string[]>        comPar = HTMLOperator.GetCompanyParameters(webAddressMain);
            List <Task <Company> > tasks  = new List <Task <Company> >();
            int counter = 0;

            foreach (string[] pair in comPar)
            {
                if (counter == 10)
                {
                    await Task.Delay(delay);

                    counter = 0;
                }
                tasks.Add(GetCompany(pair[0], pair[1]));

                counter++;
            }

            Company[] companies = await Task.WhenAll(tasks);

            return(companies);
        }