c# - Does more specific exception handling improve performance? -
if can catch more specific exception prevent clr doing work , benefit performance wise ? if know might socket exception not care handling differently other exception better still have more specific catch ? working on microframework small improvements in performance , resources worth asking about. catch (system.net.sockets.socketexception netex) { } catch (exception ex) { } i not think in terms of performance. from code correctness perspective: should catch specific exception can. when catch exception exception handler swallow any exception if not prepared handle it. imagine argumentnullexception thrown. catch block swallow , cause confusion. if prepared handle socketexception catch that. if less performant it. code correctness not sacrifice such miniscule performance gain* * or no performance gain @ - almost there zero execution time performance implication @ all. did benchmark on computer , performanc...