Follow up from question here: Cleanest way to write retry logic?
In the answer, a generic class to retry functions is defined and used as such:
Retry.Do(() => SomeFunctionThatCanFail(), TimeSpan.FromSeconds(1));
How would you implement a generic retry, where the constructor can throw also?
So I don't just want to retry:
SomeFunctionThatCanFail()
I want to retry the following block in a generic fashion:
SomeClass sc = new SomeClass();
sc.SomeFunctionThatCanFail();
I did not realise I could put a block of code into the Lambda expression. This is exactly what I want: