Skip to content

Instantly share code, notes, and snippets.

@chadman
Created April 7, 2016 15:17
Invoke code with a retry
private T ActionWithRetry<T>(Func<T> fn) {
int retryCount = 0;
bool success = false;
while (retryCount < 4 && !success) {
try {
return fn();
}
catch (Exception e) {
retryCount++;
}
}
return default(T);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment