Почему делает компилятор C# MS, жалуются, что "не все пути выполнения кода возвращают значение" в следующем сценарии?
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?
}
}
Спасибо!