You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After var result = entities.Adapt(dtos); ran: ReferenceEquals(result, dtos) returns false that would be ok (I think it should be true ),
But ReferenceEquals(result.First(), dtos.First()) returns false that is not ok, The elements in these two IList should be the same instance. var dtoResult = entity.Adapt(dto); works well, ReferenceEquals(dtoResult, dto) returns true.
What's the issue? public static TDestination Adapt<TSource,TDestination>(this TSource source, TDestination destination) should always use the destination instance and update its values and returns the destination instance, but it does not work on IList<T>, it returns a new instance of IList<T> and creates new instance for T.
The text was updated successfully, but these errors were encountered:
Mapster: 7.4.1-pre01
.Net: 8.0
Method
public static TDestination Adapt<TSource,TDestination>(this TSource source, TDestination destination)
After
var result = entities.Adapt(dtos);
ran:ReferenceEquals(result, dtos)
returnsfalse
that would be ok (I think it should betrue
),But
ReferenceEquals(result.First(), dtos.First())
returnsfalse
that is not ok, The elements in these twoIList
should be the same instance.var dtoResult = entity.Adapt(dto);
works well,ReferenceEquals(dtoResult, dto)
returnstrue
.What's the issue?
public static TDestination Adapt<TSource,TDestination>(this TSource source, TDestination destination)
should always use thedestination
instance and update its values and returns thedestination
instance, but it does not work onIList<T>
, it returns a new instance ofIList<T>
and creates new instance forT
.The text was updated successfully, but these errors were encountered: