I'm not quite sure how best ask this question, so please feel free to edit...
I have a "Utilities" class that contains common functionality used throughout my application. One of my methods logs exeptions like this:
internal static void logExeption(Type typeOfClass, string methodName, Exception exeption )
{
//Do some logging here
}
Then I'd like to call it throughout my application whenever I catch an exception like so:
try{
//perform some action
}
catch(Exception ex)
{
Utils.logExeption(this.GetType(), System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
}
I would like to know if there's a way I can avoid passing in the first two parameters and just figure out the context of the Class/Method where the exception originated right in the logException method. This will make things cleaner for me in the long run.