diff --git a/src/Mapster/Adapters/ClassAdapter.cs b/src/Mapster/Adapters/ClassAdapter.cs index 407c5a5b..6d12e57b 100644 --- a/src/Mapster/Adapters/ClassAdapter.cs +++ b/src/Mapster/Adapters/ClassAdapter.cs @@ -181,9 +181,9 @@ protected override Expression CreateBlockExpression(Expression source, Expressio private static Expression SetValueByReflection(MemberMapping member, MemberExpression adapt) { var typeofExpression = Expression.Constant(member.Destination!.Type); - var getPropertyMethod = typeof(Type).GetMethod("GetProperty", new[] { typeof(string) })!; + var getPropertyMethod = typeof(Type).GetMethod("GetProperty", new[] { typeof(string), typeof(Type) })!; var getPropertyExpression = Expression.Call(typeofExpression, getPropertyMethod, - Expression.Constant(member.DestinationMember.Name, member.DestinationMember.Type)); + new[] { Expression.Constant(member.DestinationMember.Name), Expression.Constant(member.DestinationMember.Type) }); var setValueMethod = typeof(PropertyInfo).GetMethod("SetValue", new[] { typeof(object), typeof(object) })!; var memberAsObject = adapt.To(typeof(object));