コード例 #1
0
        /// <summary>
        /// Retries the specified action.
        /// </summary>
        /// <param name="action">The action.</param>
        /// <param name="maxTries">The maximum tries.</param>
        public static void Retry(Action action, int maxTries = DefaultMaxTries)
        {
            int func()
            {
                action();
                return(0);
            }

            Retrier.Retry <int, Exception>(func, maxTries);
        }
コード例 #2
0
 /// <summary>
 /// Retries the specified function.
 /// </summary>
 /// <typeparam name="TResult">The type of the t result.</typeparam>
 /// <param name="func">The function.</param>
 /// <param name="maxTries">The maximum tries.</param>
 /// <returns>TResult.</returns>
 public static TResult Retry <TResult>(Func <TResult> func, int maxTries = DefaultMaxTries)
 {
     return(Retrier.Retry <TResult, Exception>(func, maxTries));
 }