From 2f2bdf7ea0f6ac23f39e0d867e93a90374cc21ae Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 4 Feb 2019 00:09:04 +0000 Subject: Finished ParseMultiple method --- Aggregator/Parser/Parser.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Aggregator/Parser/Parser.cs') diff --git a/Aggregator/Parser/Parser.cs b/Aggregator/Parser/Parser.cs index c9ad038..9e91a77 100644 --- a/Aggregator/Parser/Parser.cs +++ b/Aggregator/Parser/Parser.cs @@ -17,10 +17,14 @@ namespace Aggregator.Parser { ArticleLink = article[config.ArticleLink].Value, ImageLink = article[config.ImageLink].Attribute("url").Value, PublishDate = DateTime.Parse(article[config.PublishDate].Value) - }).Distinct().ToArray(); + }).Distinct(); } - public static IEnumerable> ParseMultiple(string xmls) { - + public static IEnumerable
ParseMultiple(string[] xmls, List configs) { + if (configs.Count == 0 || xmls.Length == 0 || (xmls.Length != configs.Count)) { + return null; + } else { + return xmls.Select((xml, index) => Parse(xml, configs[index])).SelectMany(i => i); + } } } } \ No newline at end of file -- cgit v1.2.3-13-gbd6f