1

I have run into the same problem as this user here:

Handle exception from nHibernate EnumStringType when enum values don't match string values

The question is already answered with some sample code.

I used this sample code to create a more elaborate, generic class that does the same thing, but provides more flexibility.

I am humbly proud of my code (albeit it only slightly modifies the original answer) and would like to share it to people stumbling upon the same issue.

Is it OK to post my "improved" code as another answer, or should I edit the original answer with my code (again, it only slightly modifies the code and adds some generics / failsafes and documentation) or just not do it at all?

1
  • You could throw it in a gist and then add a comment on that answer pointing to it.
    – user1228
    Sep 25, 2015 at 16:16

1 Answer 1

6

The original answer shows the main algorithm of the solution. Adding all the error handling and other facilities can hide the main algorithm. Hence I would recommend not changing the original answer.

Small enhancements can often be described in comments. The answer's author can then incorporate them, or not, as they see fit.

Large enhancements are best done as a new answer. It should give credit to the original answer and make it clear that it is based on and improves that original. The purpose of the enhancements should be described.

1
  • 1
    This is all correct, but note further that there's no real need for e.g. Community Wiki here; a significant improvement along a new line of approach to an existing answer deserves whatever rep it may gain independently. Sep 25, 2015 at 9:27

You must log in to answer this question.

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