Class SystemTextJsonDeepCloneStrategy<T>
Provides a deep copy implementation using System.Text.Json.
public sealed class SystemTextJsonDeepCloneStrategy<T> : ICloneStrategy<T>
Type Parameters
T
The type of the object to be deep-copied.
- Inheritance
-
SystemTextJsonDeepCloneStrategy<T>
- Implements
- Inherited Members
- Extension Methods
Remarks
This implementation is not trim safe. Use different strategy or use System Text Json with source generator and pass JsonSerializerContext of your object.
Constructors
SystemTextJsonDeepCloneStrategy()
public SystemTextJsonDeepCloneStrategy()
Fields
Instance
Represents a static field providing an instance of SystemTextJsonDeepCloneStrategy<T>.
public static readonly ICloneStrategy<T> Instance
Field Value
Methods
CloneObject(T)
public T? CloneObject(T item)
Parameters
item
T
Returns
- T