public override int Serialize(TSource source, SerializationContext context) { float value = GetValue(source); if (IsOptional && value == DefaultValue) { return(0); } return(WritePrefix(context) + context.EncodeSingle(value)); }