Example #1
0
        static string SerializeByBinaryFormatter(SerializableTagCollection serializableTagCollection)
        {
            var binaryFormatter = new BinaryFormatter();

            using (var memoryStream = new MemoryStream())
            {
                binaryFormatter.Serialize(memoryStream, serializableTagCollection);
                return(StringByteArrayConverter.ByteArrayToString(memoryStream.GetBuffer()));
            }
        }
Example #2
0
        static SerializableTagCollection DeserializeByBinaryFormatter(string hexadecimalString)
        {
            var bytes = StringByteArrayConverter.StringToByteArray(hexadecimalString);

            var binaryFormatter = new BinaryFormatter();

            using (var memoryStream = new MemoryStream(bytes))
            {
                return(( SerializableTagCollection )binaryFormatter.Deserialize(memoryStream));
            }
        }