I'm working on a project and every single method I write starts off identical to:
public blah blah() // my method signature
{
Tracing.StartOfMethod("Repositroy");
// I'll declare variables as needed
try
{
// the content here differs for every method
}
catch (Exception ex)
{
ErrorSignal.FromCurrentContext().Raise(ex);
// sometimes I'll add something here
}
finally
{
// sometimes something here
Tracing.EndOfMethod();
}
// return result
}
Every method ends up differently depending on what it does, but I always start with the same structure. Can somebody tell me if there's a way to automate writing this code so it's not so repetitive? Maybe "Insert Snippet"? If so, how do I define snippets? Thanks.