相关文章推荐
没读研的炒粉  ·  p = ...·  3 月前    · 
逼格高的凉面  ·  C# WebService ...·  1 年前    · 
I have this scraper code for google maps and am gettin a warnin on " return result2;" wat could be wrong because its not working or returnin results??
if ( this .CanAddRes(result, mapScrapeResult)) Monitor.Enter(result); result.Add(mapScrapeResult); finally Monitor.Exit(result); if ( this .terminated) result2 = false ; return result2; if ( base .Callback != null ) base .Callback.Process(mapScrapeResult); return text.IndexOf( " </div>Next</a>" ) >= 0 ; return result2; Isn't it obvious??
You have two return statements in a row. The second return statment will never be executed becuase you already returned a boolean value with the first return.
The return statement returns control to the caller immediately. No other code in the method will be executed after that.
If you couldn't see this, I HIGHLY suggest picking up a beginners book on C# and working through it. This is a very basic concept you missed. In addition to the correct Dave answer:
I would add you really want to work in a warning-free manner, fixing the code each time you have any warnings. You can work with warning but this is like leaving with broken windows. If you accumulate warnings, you will need to ignore all of them, so the valuable warning mechanism will be rendered virtually useless. Besides, this is too stressful.
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •