I have 2 classes, User
and ExtendedUser
. ExtendedUser
inherits from User
and just adds 2 int
fields - Nothing fancy.
I have a list of User
objects - List<User>
and would like to go over the list and create a list of ExtendedUser
objects, where I'd like to just fill fill the missing int
fields.
I thought about using the Select
method of Linq to create the new objects, but it won't copy the User
to ExtendedUser
- so I'll need to recreate those objects, which doesn't make sense for me.
EDIT:
User
is an Entity, where as ExtendedUser
is a custom class inheriting from that entity (but not an entity by itself).
It seems the easiest solution here would be composition, though conceptually - inheritance would have worked better.
Any smart solutions here? :)
Thanks!