This question already has an answer here:
This seems to be related to other meta questions, but I think there is a qualitative difference.
While this is obviously a site where specific questions are asked and specific answers are given (where possible), very often including example code, a line is crossed when the question's ideal answer is solely a snippet of example code that solves the problem behind the question asked, without any solicited explanation, and could just "drop in" to the questioner's codebase with minimal editing. Such a question is little more than a request for free development work on the part of the community, contrary to the spirit of the site where users seek to increase their knowledge by asking questions.
The usual response is to close such posts as "not a real question"; however, I think that's misleading based on the text of that reason; it is not, in fact, difficult to tell what is being asked in the question. Quite the contrary, the problem is that it's so glaringly obvious what the questioner wants that it's insulting.
Another possible response is to close the question as "too localized"; the exact code snippet would be unlikely to help anyone else even as a guide. However, that too can be misleading; it's very rare that the requested solution is so specialized that nobody else would ever be able to apply any part of it in their own work.
I propose the following close reason:
- Overt request for code - While StackOverflow welcomes questions that require answers with example code to illustrate the solution, this question does not demonstrate any effort made towards solving the problem, and instead simply solicits answers consisting primarily of original working code that could be copied and pasted into a program.