Esempio n. 1
0
 public void SerializePossibleNullableItem(object obj, MapItemInfo info, ref BitTarget header)
 {
     // Say it's "not null" if it is nullable.
     if (info.IsNullable)
     {
         header.WriteBitOn();
     }
     SerializeItemNoSetup(obj, info, ref header, info.IsNullable);
 }
Esempio n. 2
0
        // Returns: Whether the type has changed.
        bool WriteHeaderNullAndInheritance(Type actualType, Converter item, ref BitTarget target)
        {
            target.WriteBitOn(); // Null

            bool sameType = item.ItemType == actualType;

            target.WriteBitWith(sameType);
            return(sameType);
        }
Esempio n. 3
0
        bool TryWriteListInheritance(SaveInheritanceAttribute info, Type actualType, bool writeOnIfSuccessful, ref BitTarget header)
        {
            if (info.IndexSerializeCache !.TryGetValue(actualType, out uint pos))
            {
                if (writeOnIfSuccessful)
                {
                    header.WriteBitOn();
                }
                WriteCompressedInt(pos, ref header);
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
        public void WriteString(string?str)
        {
            var header = new BitTarget(this);

            if (str == null)
            {
                header.WriteBitOff();
            }
            else
            {
                header.WriteBitOn();
                WriteNonNullString(str !);
            }
        }