DTO cloning in C #

Currently, I am implementing IClonable to clone my DTOs, but this (and alternatives such as clone ctor) means that I need to add implementation logic to my (otherwise) data-only object.

Is there a better way to clone a DTO, or does it include cloning logic that is considered normal?

+3
source share
1 answer

Such logic is so fundamental that I think it stretches it to call it implementation logic. This can make a lot more sense to clone like this:

  • You can call MemberwiseClone to make a shallow copy
  • DTO knows everything it takes to clone
  • ,

DTO, .

+3

Source: https://habr.com/ru/post/1772416/


All Articles