Skip to content

Commit 965fc23

Browse files
committed
fix class SetValueByReflection
1 parent 155a723 commit 965fc23

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Mapster/Adapters/ClassAdapter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ protected override Expression CreateBlockExpression(Expression source, Expressio
181181
private static Expression SetValueByReflection(MemberMapping member, MemberExpression adapt)
182182
{
183183
var typeofExpression = Expression.Constant(member.Destination!.Type);
184-
var getPropertyMethod = typeof(Type).GetMethod("GetProperty", new[] { typeof(string) })!;
184+
var getPropertyMethod = typeof(Type).GetMethod("GetProperty", new[] { typeof(string), typeof(Type) })!;
185185
var getPropertyExpression = Expression.Call(typeofExpression, getPropertyMethod,
186-
Expression.Constant(member.DestinationMember.Name, member.DestinationMember.Type));
186+
new[] { Expression.Constant(member.DestinationMember.Name), Expression.Constant(member.DestinationMember.Type) });
187187
var setValueMethod =
188188
typeof(PropertyInfo).GetMethod("SetValue", new[] { typeof(object), typeof(object) })!;
189189
var memberAsObject = adapt.To(typeof(object));

0 commit comments

Comments
 (0)