I’ve 2 classes. One is a linq-to-sql class and the other is a seriazable data-dump class.
Examples:
Class TableNotes
Id
UserId
NoteText
… functionality
[Serializable]
Class NoteDump
NoteText
… functionality
They both would share a common set of functionality. I decide it is best for me not to duplicate this functionality and thus add it to TableNotes only. I will use the NoteDump object only for dumping data.
The question is, I want to covert a NoteDump to a TableNotes. Which class should handle the conversion and why? I.e TableNotes could take a NoteDump or NoteDump could return a new object of type of TableNotes.. or I could use a conversion operator.
Really, the choice is yours. I personally use the “FromXXXX” convention inside the class it will become. In this case, it would be a method on TableNotes:
If you need them to convert back and forth (or you think there could be future classes with a similar structure), consider inheriting from a base class or interface.