In general copy-pasting an answer and changing one word (or a noticeably small amount of text) is indeed plagiarism if there are no attribution and should be flagged accordingly. Whether the version with attribution can be considered answer is up for you as a reader to consider in each individual case. Ideally such answer will include explanation why the change was needed making it acceptable on SO.
In this particular case there is really no plagiarism - iterating through collection of items in C# can indeed be done in different ways but there is very small variation of how you can actually write those - so code will look similar. Author of newer question was trying to make contrast between different iteration methods but realistically failed to highlight that. I personally agree with commenters on that post that there is not much value in that suggestion, but it is a valid suggestion answering the question. I would not vote it up or down, but I can see reasons for both votes (+7/-3 as of 2022 sound about a right split for me).
var idList = new int[]{1, 2, 3, 4};
is very likely copied (the same in a third answer), but it is probably not sufficient evidence.