예제 #1
0
    static T SerializationRoundtrip <T>(T item)
    {
        using var buf = new MemoryStream();
        var formatter = RuntimeData.CreateFormatter();

        formatter.Serialize(buf, item);
        buf.Position = 0;
        return((T)formatter.Deserialize(buf));
    }