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); }
// 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); }
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); }
public void WriteString(string?str) { var header = new BitTarget(this); if (str == null) { header.WriteBitOff(); } else { header.WriteBitOn(); WriteNonNullString(str !); } }