I have a c# class library for my debugging purpose where I will create methods whenever I need to do something.
Each and every method I need to append to the try catch and some other code snippet automatically. Say for ex. as below, when I create a new method, the try/catch and the snippet inside should be created automatically for each and every method when I create.
Any idea how I can do this?
public static void MyMethod1()
{
try
{
string loggerFileName = System.Reflection.MethodBase.GetCurrentMethod().Name.ToString();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}