c# - not all code paths return a value using html agility pack -
I'm new to the C # and html agility pack, I've written this code to isolate a webpage.
I'm receiving an error message called "SiteParser.GetFeatureSubCategories (HtmlAgilityPack.HtmlNode, Category)": All code paths do not return a value "I just wondered Was there anybody able to give me advice on why this error message is happening thanks to any help you can. Your method will Private IList & lt; Category & gt; GetFeatureSubCategories (HtmlNode standard, category category) {list & lt; Category & gt; Categories = new list & lt; Category & gt; (); {If (category.name == "Featured") {var nodes = std.SelectNodes ("// span [contains (@ class, 'widget')] [position () & lt; = 4]"); Forwarding (nodes in nodes) {string name = SiteParserUtilities.ParserUtilities.CleanText (System.Net.WebUtility.HtmlDecode (node.InnerText)); String url = node.Attributes ["href"]. Values; String identifier = url.Split ('/'). Last (). Change (".html", ""); WriteQueue.write (string.Format ("category [{0}] .. {1}", name, url)); IList & LT; Category & gt; Sub = GetSubCategories (STD); Category c = new category () {active = true, categories = sub.ToArray (), description = "", identifier = identifier, name = name, product = new product [0], url = url,}; StatisticCounters.CategoriesCounter (); Categories.Add (c); }}}}
return anywhere in the code to
IList & lt; grade & gt; If you want to return
categories by your method, then you can make a return statement before the end of the law.
Private IList & lt; Category & Gt; GetFeatureSubCategories (HtmlNode standard, category category) {list & lt; grade & gt; categories = new list & lt; grade & gt; (); {// ............. .... return categories;}
Comments
Post a Comment