public override void Serialize(BinaryTypesWriter bw, Type type, SerializerSettings settings, ISerializerArg serializerArg, object value) { bw.Write(value != null); if (value == null) { return; } var nullableUnderlyingType = Nullable.GetUnderlyingType(type); var serializer = SerializerRegistry.GetSerializer(nullableUnderlyingType); Serializer.SerializeObject(nullableUnderlyingType, value, bw, settings, serializer, serializerArg); }
public override void Serialize(BinaryTypesWriter bw, Type type, SerializerSettings settings, ISerializerArg serializerArg, object value) { var typedSerializerArg = GetSerializerArg <FloatingPointSerializerArg>(type, settings, serializerArg); if (typedSerializerArg != null) { if (typedSerializerArg.DecimalDigits >= 0) { bw.WriteCompactDecimal(Convert.ToDecimal(value), typedSerializerArg.DecimalDigits); return; } } bw.Write((float)(object)value); }
public override void Serialize(BinaryTypesWriter bw, Type type, SerializerSettings settings, ISerializerArg serializerArg, object value) { bw.Write((string)(object)value); }