示例#1
0
        A ISubTypeSerializer <A> .ReadSubType(ref ProtoReader.State state, SubTypeState <A> value)
        {
            int field;

            value.OnBeforeDeserialize((obj, ctx) => obj.OnBeforeDeserialize());
            while ((field = state.ReadFieldHeader()) != 0)
            {
                switch (field)
                {
                case 1:
                    value.Value.AVal = state.ReadInt32();
                    break;

                case 4:
                    value.ReadSubType <B>(ref state, this);
                    break;

                default:
                    state.SkipField();
                    break;
                }
            }
            value.Value.OnAfterDeserialize();
            return(value.Value);
        }
示例#2
0
        B ISubTypeSerializer <B> .ReadSubType(ref ProtoReader.State state, SubTypeState <B> value)
        {
            int field;

            while ((field = state.ReadFieldHeader()) != 0)
            {
                switch (field)
                {
                case 2:
                    value.Value.BVal = state.ReadInt32();
                    break;

                case 5:
                    value.ReadSubType <C>(ref state, this);
                    break;

                default:
                    state.SkipField();
                    break;
                }
            }
            return(value.Value);
        }