Quote:
Originally Posted by nTL3fTy
|
i duno how this is related to what i was talking about , but maybe you mean that i should use tryparse instead of converting or parse so incase it failed it return a bool ?
when system convert return error it break the try block and does not set the bool to true
when the try parse fails it return false
same result ?
so instead of ONE try catch block i create THIRTY if/else with tryparse ?
try
{
switch
{
case when fail does not set the value to true
case when fail does not set the value to true
case when fail does not set the value to true
}
}
catch
{
}
but with try parse
switch
{
case
if(try parse){}
else{}
case
if(try parse){}
else{}
case
if(try parse){}
else{}
case
if(try parse){}
else{}
case
if(try parse){}
else{}
case
if(try parse){}
else{}
case
if(try parse){}
else{}
}
i don't think tryparse is better here , don't you think ?
i need that error to inform me that im doing something wrong and set the whole method to false , tryparse won't give me that error so ill need to handle it on each case , got my point ?