I have a C# console application. This application has many different projects/C# class files, each of them dedicated to parsing a certain kind of XML and creating an object, called 'Response'. Now, each of these individual projects parses the XML, and gets an error msg field (stores it in the 'Response' object) from these different xmls. Now, based on this error msg, I want to set the value of an other field of the 'Response' object. This processing logic is the same for all the projects. So my question is, should that processing be done just before saving the 'Response' object in the DB, and hence making changes to only 1 single file? Or, should this be a common method in a base class, invoked on all the 30 projects/C# class files?

  • Presumably these 30 different Response classes all inherit from the same base class? – Sam Axe Mar 9 '15 at 9:42
  • @Dan-o: yes, they do – karan k Mar 9 '15 at 9:43

So just going purely on the limited information in your description, the common base class seems like an appropriate place to put common processing logic.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.