Hey all,,
We often need to run something before some code logic and after it was executed.

As a simple example we can take the try-catch block, everybody has this in their application and is using it more then two times for sure.

What we can do in this case is to write a generic method that will allow to run our code inside a try-catch statement. This method will look like this:


Code:
public static void TryDo(Action action, ILogger logger, string messageDescription)
{
try
{
action();
}
catch (Exception)
{
// Do some logging stuff here
}
}
........ »www.extremedev.blogspot.com DevelopmentSolutions?d%3DyIl2AUoC8zA DevelopmentSolutions?d%3D63t7Ie-LG7Y DevelopmentSolutions?i%3DP7ry3HUf7V4:YPxhrXOJF_E:V_sGLiPBpWU DevelopmentSolutions?d%3Dqj6IDK7rITs P7ry3HUf7V4