- In your application, you have implemented the LogException(string message) method to log exceptions. When an exception is thrown from your application, you want to log and rethrow the original exception. How do you achieve this?
-
catch(Exception ex){LogException(ex.Message); throw;}
-
catch(Exception ex){LogException(ex.Message); throw ex;}
-
catch{LogException(ex.Message); throw new Exception();}
-
catch{LogException(ex.Message); rethrow;}
-
- You have created an application where you have implemented custom exception types and have also implemented multiple log methods, as follows:
public class CustomException1 : System.Exception{}
public class CustomException2 : CustomException1 {}
public class CustomException3 : CustomException1{}
void Log(Exception ex){}
void Log(CustomException2 ex) {}
void Log(CustomException3 ex) {}
You have a method that can throw one of...