BACK
TOP
Try-Catch-When
Matías Creimerman - Buenos Aires, Argentina - 2017-02-14

Try-Catch-When consists of a try-catch block with a one or more when clause.

For example:

try{
LegacyOperation();
}
catch (COMException e) when (e.ErrorCode == 0x1234){
// Handle the *specific* error I was expecting.
}
catch (COMException e) when (e.ErrorCode == 0x5678){
// Handle the *specific* error I was expecting}
This content is property of Matias Creimerman
Any misuse of this material will be punishable
This work is licensed under a
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License
Creative Commons License