从具有相同属性的其他对象创建对象对象、属性

2023-09-03 15:16:59 作者:女人如花、花带刺

我在C#中的对象,可以说20的属性,这是一个datacontract的一部分。我也有类似的性质,这是我想从响应对象来填充另一业务实体。有没有办法做到这一点比其他分配一个对象的每个属性其他相应的属性?

I have an object in C# with lets say 20 properties and it's part of a datacontract. I also have another business entity with similar properties, which I want to populate from the response object. Is there any way to do this other than assigning each property of one object to the corresponding properties of the other?

推荐答案

是的,看看 Automapper

 
精彩推荐
图片推荐