protected async Task<T> TryOperation<T>(int maxRetryCount,Func<Task<T>> funcGetData) { Exception lastException = null; var fixdMaxRetryCount = maxRetryCount > 1 ? maxRetryCount : 1; for (var i=0;i< fixdMaxRetryCount; i++) { try { var data = await funcGetData().ConfigureAwait(false); return data; } catch(Exception e) { lastException = e; DoLogException(e); await Task.Delay(TimeSpan.FromSeconds(Math.Pow(2, i - 1))).ConfigureAwait(false); } } throw lastException; }