Is there maybe something like a "when" statement in C#?
The reason I want this is because an
if statement only checks once if a certain property is
true at a particular time, but I want it to wait until the property is
Anybody know something I can do in C# that would be similar to a "when" statement?
What you want is SpinWait
SpinWait.SpinUntil(() => condition);
It will sit there until it either times out (with your specified timeout) or the condition is met.