✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
public static Func
Cloner()
{
var p = Expression.Parameter(typeof(T));
var n = Expression.MemberInit(Expression.New(typeof(T)),
typeof(T).GetProperties().Select(pi =>
Expression.Bind(pi, Expression.Property(p, pi))));
return Expression.Lambda
>(n, p).Compile();
}
Що головне у цьому підході?