以下のコードの Worker.SendMail では、自分自身の参照を RetryEmailSend メソッドに渡す必要がありますが、それを参照する方法がわかりません。どんな助けでも大歓迎です。
public class Worker
{
public bool SendMail()
{
try
{
//implementation
}
catch (Exception ex)
{
RetryEmailSend(NEED REFERENCE TO THIS INSTANCE Worker.SendMail());
}
return true;
}
}
public static class Util
{
public static bool RetryAction(Action action)
{
if (action == null)
throw new ArgumentNullException("action");
try { action(); return true; }
catch
{
return false;
}
}
public static bool RetryEmailSend(NEED INPUT TYPE HERE)
{
return Util.RetryAction(() => INPUT TYPE);
}
}