这两种方法表现出重复:
public static Expression> EditDtoSelector() { return f => new FooEditDto { PropertyA = f.PropertyA, PropertyB = f.PropertyB, PropertyC = f.PropertyC, PropertyD = f.PropertyD, PropertyE = f.PropertyE }; } public static Expression > ListDtoSelector() { return f => new FooDto { PropertyA = f.PropertyA, PropertyB = f.PropertyB, PropertyC = f.PropertyC }; }
我怎样才能重构以消除这种重复?
更新:哎呀,我忽略了一个重要的观点.FooEditDto是FooDto的子类.