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