I know how to use try/catch block in case of database calls and know how to use “using” directive in context of using try/finally construction as well.
But, can I mix them? I mean when I use “using” directive can I use try/catch construction as well because I still need to handle possible errors?
Of course you can do it:
usingis translated by the compiler into atry..finally, so it’s not very different from nesting atry..catchinside atry..finally.