Does anyone want a framework/class which allows me to clone by values .Net objects? I\'m only interested with public read/write properties (namely DataContracts), and I don\
There are a lot of libraries that do this operation. You can see benchmark results here:
In short words, if you need peformance, do it manually, it really faster. Also, some libraries allows to peform shallow cloning (by the question, it is good variant for you), which is faster. And do not use BinaryFormatter
if you need any performance.
Also, @frakon mentions that Expressions trees have same speed as IL Emit, it is slightly incorrect. Expressions Tree is slightly slower, but it can be used in partially trusted app.
Manual 13ms
DeepCloner (IL Emit) 167ms
DeepCloner (Expressions) 267ms
CloneExtensions (Expressions) 560ms
NClone 901ms
Clone.Behave! 8551ms
GeorgeCloney 1996ms
Nuclex.Cloning n/a (Crashed)
FastDeepCloner 1882ms
BinaryFormatter 15000ms