There are times that a method needs to be run several times until it validates. In my case there are expressions like bar.Name.Equals("John Doe")
which I want to run and run until this expression validates.
Something like:
bool succeeded = TryUntillOk(bar.Name.Equals("John Doe"), 15, 100);
where TryUntillOk
would be a method that runs this expression 15 times with a sleep of 100ms between each call.
I read this excellent list of answers to similar issues but in my case there is no standar delegate that this TryUntillOk
method would accept.
The title of the question is not constructive. Feel free to edit it :)