Return in catch block?

Posted by lowlyintern on Stack Overflow See other posts from Stack Overflow or by lowlyintern
Published on 2010-04-22T10:46:23Z Indexed on 2010/04/22 10:53 UTC
Read the original article Hit count: 241

Filed under:
|

Is is wrong to have a return statement in a catch block? What are the alternatives?
i.e:

public bool SomeFunction()
{
    try
    {
        //somecode
        return true;
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.message);
        return false;
    }

}

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET