Dale Burrell
asked on
VWDEE 2008 - How to Hide - The variable is declared but never used
When I use a try/catch block to handle specific errors I often don't need to make use of the error variable - but then I get a warning "The variable is declared but never used". Is there anyway to remove this warning in this specific circumstance? See code for example...
// gives warning "warning CS0168: The variable 'Error' is declared but never used"
catch (ThreadAbortException Error)
{
// The error type itself tells me everything I need to know, meaning I don't need to inspect the variable 'Error' - so how to hide the warning in this case?
LogError("Maintenance:Thread - Stopped");
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BTW, I think you can simply solve this by leaving out a variable name, i.e.:
> catch (ThreadAbortException)
> catch (ThreadAbortException)
ASKER
Doh! How silly I didn't even think to try that - works a treat - sorry can't give you any points :(
No problem ...
>>>> sorry can't give you any points :(
You could use the 'Request Attention' button above and let a Moderator reopen the question.
Regards, Alex
You could use the 'Request Attention' button above and let a Moderator reopen the question.
Regards, Alex
IMO there's no need to, it's not worth the effort ...
ASKER
Open in new window