From 54a0d6ec569f5ea137c7bb57743bf66cbd159f36 Mon Sep 17 00:00:00 2001 From: wayne Date: Sat, 21 Sep 2024 20:15:53 +0800 Subject: [PATCH] Json clone. --- src/EasyFrameWork/Extend/ExtObject.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/EasyFrameWork/Extend/ExtObject.cs diff --git a/src/EasyFrameWork/Extend/ExtObject.cs b/src/EasyFrameWork/Extend/ExtObject.cs new file mode 100644 index 000000000..e440fe9cc --- /dev/null +++ b/src/EasyFrameWork/Extend/ExtObject.cs @@ -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(this T obj) where T : class + { + return JsonConverter.Deserialize(JsonConverter.Serialize(obj)); + } + } +}