Skip to content

Commit

Permalink
Json clone.
Browse files Browse the repository at this point in the history
  • Loading branch information
SeriaWei committed Sep 21, 2024
1 parent ae10770 commit 54a0d6e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/EasyFrameWork/Extend/ExtObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* http://www.zkea.net/
* Copyright (c) ZKEASOFT. All rights reserved.
* http://www.zkea.net/licenses */

using Easy.Serializer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Easy.Extend
{
public static class ExtObject
{
public static T Clone<T>(this T obj) where T : class
{
return JsonConverter.Deserialize<T>(JsonConverter.Serialize(obj));
}
}
}

0 comments on commit 54a0d6e

Please sign in to comment.