Ejemplo n.º 1
0
        public static RdProperty <T> Read(SerializationCtx ctx, UnsafeReader reader, CtxReadDelegate <T> readValue, CtxWriteDelegate <T> writeValue)
        {
            var id  = reader.ReadRdId();
            var res = new RdProperty <T>(readValue, writeValue).WithId(id);

            if (reader.ReadBool())
            {
                res.myProperty.Value = readValue(ctx, reader);
            }
            return(res);
        }
Ejemplo n.º 2
0
 public static void Write(SerializationCtx ctx, UnsafeWriter writer, RdProperty <T> value)
 {
     Assertion.Assert(!value.RdId.IsNil, "!value.RdId.IsNil");
     writer.Write(value.RdId);
     if (value.HasValue())
     {
         writer.Write(true);
         value.WriteValueDelegate(ctx, writer, value.Value);
     }
     else
     {
         writer.Write(false);
     }
 }