Invert “if” statement to reduce nesting
问题 When I ran ReSharper on my code, for example: if (some condition) { Some code... } ReSharper gave me the above warning (Invert "if" statement to reduce nesting), and suggested the following correction: if (!some condition) return; Some code... I would like to understand why that's better. I always thought that using "return" in the middle of a method problematic, somewhat like "goto". 回答1: A return in the middle of the method is not necessarily bad. It might be better to return immediately if