I want to write some try and catch that catch any type or exception
try {
code....
}
catch (Exception ex){}
Or should it be
try {
code....
}
catch {}
?
I want to write some try and catch that catch any type or exception
try {
code....
}
catch (Exception ex){}
Or should it be
try {
code....
}
catch {}
?
Both ways are correct If you need to do something with Exception object in catch block than you should use
try {code....
}
catch (Exception ex){}
and than use ex in catch block.