Exemple #1
0
 public static async Task DelayOrYield(this IDelayProvider provider, TimeSpan delay)
 {
     if (delay == TimeSpan.Zero)
     {
         await Task.Yield();
     }
     else
     {
         await provider.DelayAsync(delay);
     }
 }
Exemple #2
0
 public static Task DelayOrYield(this IDelayProvider provider, float ms) => DelayOrYield(provider, TimeSpan.FromMilliseconds(ms));
Exemple #3
0
 public static Task DelayOrYield(this IDelayProvider provider, TimeSpan delay) => delay == TimeSpan.Zero ? provider.YieldAsync() : provider.DelayAsync(delay);