Example #1
0
        // Serialization
        public void Serialize(Guid valueToSerialize)
        {
            // Is it default value
            if (valueToSerialize == Guid.Empty)
            {
                SerializerStorage.WriteStorageFormat(new DefaultValue());
                return;
            }

            SerializerStorage.WriteStorageFormat(new ValueInDataStream());

            byte[] guidBytes = BitToolkit.ConvertGuidToByteArray(valueToSerialize); // 16 bytes
            SerializerStorage.WritePackedData(guidBytes);
        }
Example #2
0
        // Serialization of Guid
        public static byte[] SerializeGuid(Guid valueToSerialize)
        {
            // Default value has byte 0 only
            if (valueToSerialize == Guid.Empty)
            {
                return new byte[1] {
                           0
                }
            }
            ;

            // Value different then default one
            return(BitToolkit.ConvertGuidToByteArray(valueToSerialize));
        }