예제 #1
0
        public override object Deserialize(DynamicSerializer serializer, DataStream ds)
        {
            DynamicStructure dynvalue = new DynamicStructure();

            foreach (var field in Fields)
            {
                object vv = serializer.ReadField(field.Value, ds);
                dynvalue.Dictionary[field.Key.ToLower()] = vv;
            }
            return(dynvalue);
        }
예제 #2
0
        public override void Serialize(DynamicSerializer serializer, DataStream ds, object value)
        {
            DynamicStructure dynvalue = (DynamicStructure)value;

            foreach (var field in Fields)
            {
                object vv;
                if (dynvalue != null)
                {
                    dynvalue.Dictionary.TryGetValue(field.Key.ToLower(), out vv);
                }
                else
                {
                    vv = null;
                }

                serializer.WriteField(field.Value, ds, vv);
            }
        }