Exemple #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()));
            }
        }
Exemple #2
0
        public static string TagsToString(
            IEnumerable <KeyValuePair <string, string> > tags,
            IEnumerable <KeyValuePair <string, string> > builtInTags)
        {
            // Convert dictionaries to serializable lists.
            var serializableTags        = ToSerializableList(tags);
            var serializableBuiltInTags = ToSerializableList(builtInTags);

            // Pack serializable lists into single serializable class instance.
            var serializableTagCollection = new SerializableTagCollection(serializableTags, serializableBuiltInTags);

            return(SerializeByBinaryFormatter(serializableTagCollection));
        }