.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
Post a Comment