✅ how to merge two objects?
Sometimes ago I had this object:
LegData
used in method for merging and for example we can do this:
var firstLeg =
var secondLeg=
and the output will be:
then we decided move from JsonDocument to model and this merge doesn't work anymore
in case I pasted earlier output will be:
can someone understand me what to do?4 Replies
you will need to write the logic for merging two objects yourself, or use reflection (please dont)
unfortunately I should use reflection :when:
you really shouldnt.
you could write a source generator that could generate a merge method thou
that would be a much better option and provide the same "ease of use"
I'm a little bit tired of sg because this LegData model also was generated by sg from json schema :catlaugh:
This is why I can't write the logic for merging two objects, objects can be changed a little bit after nuget package update
but.. maybe using sg for merge object is a good idea
okay I will try it