Updating
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace LCU.Library.Internal.FileOperationsModels.Shared
|
||||
{
|
||||
public static class Clone
|
||||
{
|
||||
public static T DeepClone<T>(this T source)
|
||||
{
|
||||
if (ReferenceEquals(source, null))
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
var deserializeSettings = new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace };
|
||||
return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(source), deserializeSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user