예제 #1
0
        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());
        }
예제 #2
0
        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());
        }
예제 #3
0
 public static Task <Article[]> GetRadnomArticles()
 {
     return(WikipediaReader.DownloadRandomWikipediaArticles(25));
 }