I have Two Classes.
Class A:
public class A {
prop string p1 { get; set; }
prop string p2 { get; set; }
prop string p3 { get; set; }
}
Class B:
public class B {
prop string p1 { get; set; }
prop string p3 { get; set; }
}
Now assume we have an object from class B and we want to assign it to object from class A.
B b_obj = new B(){
p1 = "something",
p2 = "something else"
}
A a_obj = new A(){
p1 = b_obj.p1,
p3 = b_obj.p3,
}
I think the above solution is not best way.
What is best practice to assign b_obj to another object from class A?
Tip : All property in
class Bhas a similar property inclass A