I edited an answer on Stack Overflow, because I encountered an issue in a specific case where the original solution wasn't working: the change I made helps to make the solution work in a wider range of contexts.

My edit was approved by the original answerer but it has been later rolled back by another user (John Saunders), saying my edit was not needed in the general case.

I do believe my edit is a proper one as I explained in the comments below the answer:

  • the user who posted the question didn't explain the context, and so in my opinion the answer should cover all possible scenarios (including the one in which I spotted the answer fault)
  • as far as I can understand, on all Stack Exchange websites the answer is supposed to be as good as possible, always valid and working, and the edit feature is supposed to be used to reach this goal
  • I also found a Meta Q&A which covers a very similar case, and it seems to confirm that my edit was a proper one: if a solution works on a general case but fails on a specific one, the answer can (=>has to be) edited

It seems like the user that rolled back my edit has a different point of view (which by the way is lacking arguments in the latest comments), and asked me to move the discussion here on Meta Stack Overflow (actually I think this is a good idea, because all of our comments were about us arguing on the edit and not really useful [besides the first two of them] as far as the original Q&A is concerned).

What to do now?

For a start, I'm going to post the link to this question back inside the Stack Overflow answer comments so that John Saunders can take part in this discussion.

closed as off-topic by Gilles, Martijn Pieters, Shadow The Dragon Wizard, doppelgreener, ale Sep 4 '14 at 3:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question pertains only to a specific site in the Stack Exchange Network. Questions on Meta Stack Exchange should pertain to our network or software that drives it as a whole, within the guidelines defined in the help center. You should ask this question on the meta site where your concern originated." – Gilles, Martijn Pieters, Shadow The Dragon Wizard, doppelgreener, ale
If this question can be reworded to fit the rules in the help center, please edit the question.


Your edit was good (it handles that edge case about passing an instance of a derived type nicely while still doing what the original code did) and you did everything by the book. I'm reverting back to your edit, and I'm going to wipe the comments (except for the one pointing to this discussion).

You might want to indicate why you used x.GetType() instead of typeof(T) in the answer, so future readers would understand the importance.

  • Thank you for your response and action. I edited the answer to specify why it is important to use x.GetType() including the link to the ideone code sample. I thought it was not a good idea to post the full code inside the answer (because it was to explain why it could not work, if changed, in another scenario) and opted to post it in another answer for future reference just in case Ideone goes down..hope this is fine! – Fulvio Jun 13 '12 at 17:41
  • emh..my edit to explain the x.GetType() vs typeof(T) in the accepted answer seems to have vanished! I can't see it anymore (it read Thanks for your edit! This edit will be visible only to you until it is peer reviewed., as you can see here => i48.tinypic.com/4rtgdv.png) but now the edit is missing, and there is no trace also inside the revision history! What's going on? – Fulvio Jun 13 '12 at 18:11
  • @Fulvio It's there, see the revision history – casperOne Jun 13 '12 at 18:23
  • I couldn't see the part in which I added the "Code Safety Note" in the original answer. I've made again the edit a few minutes ago, and only later I've found that it was rejected yesterday..I had to look inside my activity and not inside the answer's revision history. Sorry casperOne & dtb for the double edit, I'm still learning how those bits of the edit workflow work. – Fulvio Jun 14 '12 at 7:47
  • @Fulvio Fixed, although I had to do the edit. Sorry about the reject, if it happens again, I'll take the people out to pasture. – casperOne Jun 14 '12 at 11:39
  • The edit that changed typeof(T) to x.GetType() is indeed a good one. I actually do not remember why I changed the OP's x.GetType() to typeof(T) when I wrote my answer back in 2010. So thanks to Fulvio for that. However, I don't see why there needs to be a big discussion of typeof(T) versus x.GetType() in my answer, as it's not relevant to the question itself (serializing an object to a string) and the OP already did the right thing by using x.GetType(). It's only interesting to those who look at the answer revision history and wonder why typeof(T) was changed to x.GetType(). – dtb Jun 14 '12 at 14:14
  • @dtb Unfortunately, your answer got rolled up in a mini rollback war. The initial edits which were suggested were rejected on the basis of being too trivial. To that end, I recommended that they expand on why the edit was made in the answer, as there was not enough space in the edit reason (and the edit was rejected erroneously). That said, if you feel that the point can be made in a more elegant way, by all means, feel free to do so. – casperOne Jun 14 '12 at 14:38
  • @casperOne: Now that there is a second answer to the question that explains this in detail, I'd just remove the discussion from my answer. Is that OK? – dtb Jun 14 '12 at 14:45
  • @dtb Let's just leave it as it is. There's no reason to kick up the dust now. – casperOne Jun 14 '12 at 15:10

My primary objection was that Fulvio never showed what his special case was. In fact, I think it was very much an edge case, so that, without seeing what his actual situation was, I felt the edit was inappropriate.

What would have been appropriate would have been a self-answer, linking to the original. He could have shown what his edge case was, and shown his solution, at the same time soliciting feedback on better solutions.

Contrast this to the "edit plus comment" situation, and you may see why I objected.

  • Reading through the topic, and knowing .Net well, I agreed with Fulvio that his edit was - maybe not very critical to the case - but still beneficial - and I was wondering heavily why did you rollback it. However, now, after reading your explanation I feel it is reasonable, too. So I revisited the history and saw that Fulvio actually explained the cause quite well in the 'message/explanation' added to the edit.. On the same token, I saw that you have not explained there why you are reverting it. While I am totally with your points, they just doesn't seem to match the facts. – quetzalcoatl Sep 16 '12 at 10:34
  • No offense or witch hunting intended - I'm new here, maybe I misread something, or maybe something was edited in te meantime, but this is how it looks for me now and I just wanted to drop you a note. – quetzalcoatl Sep 16 '12 at 10:35

Yes your edit is appropriate and also cover my question on stack overflow. I am searching for any ideal answer which can fulfill my requirement and here I got it.

Not the answer you're looking for? Browse other questions tagged .