public override int Serialize(TSource source, SerializationContext context) { uint value = GetValue(source); if (IsOptional && value == DefaultValue) { return(0); } return(WritePrefix(context) + context.EncodeUInt32(value)); }
public override int Serialize(TSource source, SerializationContext context) { Decimal value = GetValue(source); if (IsOptional && value == DefaultValue) { return(0); } return(WritePrefix(context) + ProtoDecimal.SerializeDecimal(value, context, false) + context.EncodeUInt32(suffix)); }
public override int Serialize(TSource source, SerializationContext context) { TEntityActual value = (TEntityActual)(object)GetValue(source); if (value == null) { return(0); } return(WritePrefix(context) + Serializer <TEntityActual> .Serialize(value, context) + context.EncodeUInt32(suffix)); }
public override int Serialize(TSource source, SerializationContext context) { byte[] value = GetValue(source); if (value == null) { return(0); } int count = value.Length; int len = WritePrefix(context) + context.EncodeUInt32((uint)count); if (count > 0) { context.WriteBlock(value, 0, count); } return(len + count); }
protected int WritePrefix(SerializationContext context) { return(suppressPrefix ? 0 : context.EncodeUInt32(FieldPrefix)); }