コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public override void Serialize(BinaryTypesWriter bw, Type type, SerializerSettings settings, ISerializerArg serializerArg, object value)
 {
     bw.Write((string)(object)value);
 }