Sorry that you're feeling that your answer is not appreciated, but looking through it, I can understand why it has been downvoted.... your answer does not review your code, it just presents an alternative solution without really indicating why the code in your answer is an improvement on your original code.
Code Review answers are expected to review the code, not just present alternative solutions...
If you want the code in your answer to be reviewed you should post it (with context) in a new post.
We have a special process for this: What you may and may not do after receiving answers and How to post a follow-up question?