Skip to content
chaowlert edited this page Apr 13, 2019 · 1 revision

Deep copy vs shallow copy

By default, Mapster will recursively map nested objects (deep copy). You can do shallow copying by setting ShallowCopyForSameType to true.

TypeAdapterConfig<TSource, TDestination>
    .NewConfig()
    .ShallowCopyForSameType(true);

Copy vs Merge

By default, Mapster will map all properties, even source properties containing null values. You can copy only properties that have values (merge) by using IgnoreNullValues method.

TypeAdapterConfig<TSource, TDestination>
    .NewConfig()
    .IgnoreNullValues(true);
Clone this wiki locally