C# Catch bool exception when using return

c#, try-catch

Solution

How about using Boolean.TryParse instead?

bool result = false;
Boolean.TryParse( boolUpdate, out result );
return !result;

Problem

I'm using the code below and occasionally boolUpdate is not TRUE or FALSE and I get an exception, I can't surround this with a TRY CATCH block as it is using 'return', how can I catch this correctly? ``` if (!Boolean.Parse(boolUpdate)) return true; ```

Original source