public async static Task <Article[]> GetSampleArticles(string[] titles) { var articles = new ConcurrentQueue <Article>(); var list = new List <Task>(); foreach (var title in titles) { list.Add(WikipediaReader.GenerateArticleFromWikipedia(title) .ContinueWith(t => articles.Enqueue(t.Result))); } await Task.WhenAll(list); return(articles.ToArray()); }
public async static Task <Article[]> GetSampleArticles() { var titles = ConfigurationManager.AppSettings["WikipediaSampleArticles"].Split(','); var articles = new List <Article>(); foreach (var title in titles) { var article = await WikipediaReader.GenerateArticleFromWikipedia(title); articles.Add(article); } return(articles.ToArray()); }
public static Task <Article[]> GetRadnomArticles() { return(WikipediaReader.DownloadRandomWikipediaArticles(25)); }