(I'm asking specifically for advice on the linked question, so this isn't a duplicate of Can a question with an accepted answer be closed as unanswerable because that answers the question more generally.
I've read the similar questions to this meta-question. The general advice seems to be to make the question more specific, regardless of any answers given, but I can't see how to apply that in this case.)
I submitted this question as a Q&A on Stack Overflow because it took me some time to come up with the answer and I thought it might be useful to others. The question itself is quite brief, which I assume is the reason that it was closed as 'too broad'. But I fail to see how the question could have been made more specific without pre-empting the answer, or restricting the usefulness of the answer unnecessarily.
Can someone please tell me what else I should have included in the question to bring it up to the standard expected here at SO? (In case of doubt, the answer will show exactly what information was being sought, but obviously the question cannot include the answer or it would not be a question!)
For non-10K-ers: