c# - try-catch block -


i have class different methods doing same thing reading file. want use try-catch block exception handling. want ask if there way methods go inside single try block every method give same exception "file not found"..

my preferred way of handling call common method of them, each (individually) looks like:

try {    // code } catch(someexceptiontype ex) {    dosomethingaboutthat(ex); } 

however, can delegates, i.e.

void execute(action action) {     try {        // code     } catch(someexceptiontype ex) {        //     } } 

and

execute(() => {open file}); 

Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -