#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace e_suite.API.Common.extensions;
#pragma warning restore IDE0130 // Namespace does not match folder structure

public static class ObjectExtensions
{
    public static T DeepClone<T>(this T obj)
    {
        using var stream = new MemoryStream();
        var serializer = new System.Xml.Serialization.XmlSerializer(typeof(T));

        serializer.Serialize(stream, obj);
        stream.Position = 0;
        return (T)serializer.Deserialize(stream)!;
    }
}