Copy All Object Values from Another Instance of the Same Type Using Reflection


/ Published in: C#
Save to your folder(s)

Say that you have a collection of objects empty but for IDs.
You want to do a foreach loop through those objects and lookup detail one at a time.
Unfortunately, in the foreach, you can't replace the references, you can only copy the new detail into the object.
This technique will populate your current reference from an object instance returned by a lookup.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.