Here's a puzzle, I am receiving a number in the form of a string. I need to check this input by making sure it is a valid unsigned 32 bit number (negatives should be rejected). The catch is it's for a '0 warnings' project, so this doesn't work:
try
{
uint input = Convert.ToUInt32(textBoxSN.Text.ToString());
}
catch(Exception ex)
{
//error handling
}
because I get a warning "the variable 'ex' was declared but never used." And I have no useful way to use the variable. If write a line using 'ex' that has no effect I'll then get a warning for THAT.
Furthermore, the way my program is structured, I don't want to do anything with the variable 'input' in this function, just validate. So I also get the warning that 'input' was declared but never used. Any ideas? Not super important just an interesting problem in C#.