You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
336B

  1. using Newtonsoft.Json;
  2. namespace HealthMonitor.Core.Common.Extensions
  3. {
  4. public static class ObjectExt
  5. {
  6. public static T DeepClone<T>(this object obj) where T : class
  7. {
  8. var jsonStr = JsonConvert.SerializeObject(obj);
  9. return JsonConvert.DeserializeObject<T>(jsonStr);
  10. }
  11. }
  12. }