Using ObjectMerger
ObjectMerger contains 2 projects:
- 1 library project with the ObjectMerger extension methods
- 1 Test project.
To use the ObjectMerger in your own project, you have to make a assembly reference to
ObjectMerger.Extensions.dllWhen you have done this, you can use this namespace in your class and you will see that a new extension method will appear in your Intellisense box:
MergeWith. You can use this extension method to merge your object into another object. The
MergeWith also supports (Generic) Lists, if you have two Lists<of T>, i.e. List<Person> listA and List<Person> listB, these list will be merged by calling listA.MergeWith(listB).
Please download the source code for some examples.
NOTE: When you merge 2 objects of different types, the ObjectMerger will throw an exception.