- using Newtonsoft.Json;
-
- namespace HealthMonitor.Core.Common.Extensions
- {
- public static class ObjectExt
- {
- public static T DeepClone<T>(this object obj) where T : class
- {
- var jsonStr = JsonConvert.SerializeObject(obj);
- return JsonConvert.DeserializeObject<T>(jsonStr);
- }
- }
- }
|