Converting values between same structure within different namespace. C#

前端 未结 7 1432
情书的邮戳
情书的邮戳 2021-01-13 17:28

I have two similar[all attributes are same.] structures within different namespaces.

Now when i try to copy values between the objects of these structures i am getti

7条回答
  •  时光说笑
    2021-01-13 17:46

    Use AutoMapper.

    Mapper.CreateMap();
    My.NS1.Structure struct1;
    My.NS2.Structure struct2 = (My.NS2.Structure) Mapper.Map(struct1);
    

提交回复
热议问题