I have the following piece of code pattern:
void M1(string s, string v)
{
try
{
// Do some work
}
catch(Exception ex)
{
// Encapsulate and rethrow exception
}
}
The only difference is that the return type and the number and types of parameters to the methods can vary.
I want to create a generic / templated method that handles all of the code except for the "Do some work" part, how can it be achieved.