示例#1
0
        void IPinchable.Encode(IPinchEncoder encoder)
        {
            encoder.OpenSequence(26);

            // Encode fields for version 1:
            encoder.EncodeOptionalBool(_optBool, _optBoolProperties);
            encoder.EncodeOptionalBytes(_optBytes, _optBytesProperties);
            encoder.EncodeOptionalDecimal(_optDecimal, _optDecimalProperties);
            encoder.EncodeOptionalEnumeration(_optEnumeration, _optEnumerationProperties);
            encoder.EncodeOptionalFloat32(_optFloat32, _optFloat32Properties);
            encoder.EncodeOptionalFloat64(_optFloat64, _optFloat64Properties);
            encoder.EncodeOptionalInt16(_optInt16, _optInt16Properties);
            encoder.EncodeOptionalInt32(_optInt32, _optInt32Properties);
            encoder.EncodeOptionalInt64(_optInt64, _optInt64Properties);
            encoder.EncodeOptionalInt8(_optInt8, _optInt8Properties);

            encoder.OpenSequence(_optListOfEnum.Count);

            foreach (SmallStructure value in _optListOfEnum)
            {
                encoder.EncodeOptionalStructure(value, _optListOfEnumProperties);
            }

            encoder.CloseSequence();

            encoder.EncodeOptionalString(_optString, _optStringProperties);
            encoder.EncodeOptionalStructure(_optStructure, _optStructureProperties);
            encoder.EncodeRequiredBool(_reqBool, _reqBoolProperties);
            encoder.EncodeRequiredBytes(_reqBytes, _reqBytesProperties);
            encoder.EncodeRequiredDecimal(_reqDecimal, _reqDecimalProperties);
            encoder.EncodeRequiredEnumeration(_reqEnumeration, _reqEnumerationProperties);
            encoder.EncodeRequiredFloat32(_reqFloat32, _reqFloat32Properties);
            encoder.EncodeRequiredFloat64(_reqFloat64, _reqFloat64Properties);
            encoder.EncodeRequiredInt16(_reqInt16, _reqInt16Properties);
            encoder.EncodeRequiredInt32(_reqInt32, _reqInt32Properties);
            encoder.EncodeRequiredInt64(_reqInt64, _reqInt64Properties);
            encoder.EncodeRequiredInt8(_reqInt8, _reqInt8Properties);

            encoder.OpenSequence(_reqListOfEnum.Count);

            foreach (SmallStructure value in _reqListOfEnum)
            {
                encoder.EncodeRequiredStructure(value, _reqListOfEnumProperties);
            }

            encoder.CloseSequence();

            encoder.EncodeRequiredString(_reqString, _reqStringProperties);
            encoder.EncodeRequiredStructure(_reqStructure, _reqStructureProperties);

            encoder.CloseSequence();
        }