public static void Main()
Console.WriteLine(GenericLoopWait(1, 1, () => true, true));
Console.WriteLine(GenericLoopWait(1, 1, () => 3, 1));
Console.WriteLine(GenericLoopWait(1, 1, () => "hi there", "not the same"));
public static bool GenericLoopWait<T>(int maxWaitSeconds, int waitMsPerIteration, Func<T> DoSomething, T expectedResult = default (T))
for (int i = 0; i < maxRetries; i++)
if (expectedResult.Equals(result))
return expectedResult.Equals(result);