Transient faults are errors that occur due to some temporary conditions like network connectivity issues or service unavailability for a short time period. Typically, if you retry the same operation after few seconds, you find that the error has disappeared. Service downtime for maintenance should not be confused with the transient errors.
The Microsoft Enterprise Library Transient Fault Handling Application Block available here is the best solution for developers who want their applications to be more resilient to such temporary errors.
If for some reasons like “not willing to install the application block” or avoiding “the complexity” of it, developers might want to implement their own simple versions of the retry logic. If you are one of those developers then following code can be a good starting point for you.
Action is a type of delegate that cannot have a return type. however if you want to return something from a retry method then use Func version instead. Modify Func and Action delegates signature to support your specific logic. Func can have multiple input parameters and one return parameter which must be the last one in the parameter list. Action on the other hand can have as many input parameters as you wish and cannot have a return parameter at all.
Some more samples are available here.