So they say that you learn something new everyday. They are correct today.
Digging through open source code is a great way to learn new tricks and I have been doing a fair bit of it lately - out of both necessity and curiosity. This is probably old hat to some but to me the following code is a bright and shiny hat of confusion:
public JobDetails GetNextJobToProcess()
{
//crazy for loop syntax here ...
for (;;)
{
BaseJobStore cachedJobStore = jobStore;
if (cachedJobStore == null)
return null;
JobDetails jobDetails = jobStore.GetNextJobToProcessOrWaitUntilSignaled(schedulerGuid);
if (jobDetails != null)
return jobDetails;
}
}
Turns out that the syntax represents an infinite for loop without any initialisation, conditions or increments. Might come in handy one day and these things are always good to know. I found a great article for explaining the intricacies of the for loop at Blackwasp.
Bonus points for anyone who can recognise the project the code belongs to!!!