I would personally make a special attribute for this if you want to use an attribute based approach. This is not a “standard” operation, so there is no (suitable) attribute in the structure that can be used to decorate your classes.
My approach is likely to be a class level attribute that took an array of strings for property names for each entry in the list or something like these strings.
In doing so, I wonder if the attribute-based approach is the right approach at all. You will probably need some type of manager that mediates this, since something will need to be done for the “reflection” process. It might be wiser for this class to manage relationships here, especially since it already needs to know your class hierarchy (in order to create the class first).
At that moment, when a custom class or method that can directly construct an object will work better, be more convenient for maintenance, and be much simpler than trying to use reflection and doing it dynamically.
source share