using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace AltSerializer.Tests
{
publicstaticclass Common
{
publicstatic T CloneWithSerialization<T>(T original) where T : class
{
T result;
using (MemoryStream stream = new MemoryStream())
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
binaryFormatter.Serialize(stream, original);
stream.Seek(0, SeekOrigin.Begin);
result = (T)binaryFormatter.Deserialize(stream);
}
return result;
}
}
}