public int Foo(bool flag) { if(flag) { return 1; } else { ThrowException(); // this method always throws an exception // return -1; // why do I need to add this code that will never be called? } }
谢谢!
VS 2010中提供了静态代码分析,但我认为仅适用于更昂贵的VS版本.