asp.net - How do I copy an inherited class properties to another class that inherits the same class? -


i have 3 classes:

  1. base
  2. primary
  3. secondary

primary , secondary inherit base. base has several properties.

in 1 of primary methods, create new secondary class instance. there way copy base properties primary secondary w/o having 1 one?

if 1 one, like:

secondary.property1 = primary.property1

secondary.property2 = primary.proprety2

i'm pretty sure there better way this.

you use library automapper. if code i'd map hand, unless sheer number of mappings made unwieldy.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -