jeudi 17 septembre 2015

C# template method which changes logic at runtime

I am writing a method in c# class as shown below:

using(sftpClient)
{
    sftpClient.Connect();
    try{
        //Do some process
    }
    catch(Exception ex)
    {
    }
    sftpClient.Disconnect();
}

I need to create some more methods similar to the above but the logic changes only inside the try{} catch{} block. Can anyone suggest some best way to achieve this using some design pattern?

Aucun commentaire:

Enregistrer un commentaire