.net - Copy values from one businesobject to another without loop in c# -



.net - Copy values from one businesobject to another without loop in c# -

i have 2 business objects in c# same fields , properties, different namespaces.

namespace b1 { class myclass { public string name{get;set;} public int age{get;set;} } } namespace b2 { class myclass { public string name{get;set;} public int age{get;set;} } }

now want re-create values on business object another.

b1.myclass b1 = new b1.myclass{name="john", age=18}; b2.myclass b2;

how can set property values of b2 same b1??

i have 1 method, don't want it, cause business object has mote 50 properties.

b2 = new b2.myclass{number=b1.number, age=b1.age}

that sounds job automapper, written solve problem.

c# .net namespaces

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -