ComputeUnknownGroupSize() public static method

Compute the number of bytes that would be needed to encode a group field represented by an UnknownFieldSet, including the tag.
public static ComputeUnknownGroupSize ( int fieldNumber, Google.ProtocolBuffers.UnknownFieldSet value ) : int
fieldNumber int
value Google.ProtocolBuffers.UnknownFieldSet
return int
Ejemplo n.º 1
0
        /// <summary>
        /// Computes the number of bytes required to encode this field, including field
        /// number.
        /// </summary>
        public int GetSerializedSize(int fieldNumber)
        {
            int result = 0;

            foreach (ulong value in varintList)
            {
                result += CodedOutputStream.ComputeUInt64Size(fieldNumber, value);
            }
            foreach (uint value in fixed32List)
            {
                result += CodedOutputStream.ComputeFixed32Size(fieldNumber, value);
            }
            foreach (ulong value in fixed64List)
            {
                result += CodedOutputStream.ComputeFixed64Size(fieldNumber, value);
            }
            foreach (ByteString value in lengthDelimitedList)
            {
                result += CodedOutputStream.ComputeBytesSize(fieldNumber, value);
            }
            foreach (UnknownFieldSet value in groupList)
            {
#pragma warning disable 0612
                result += CodedOutputStream.ComputeUnknownGroupSize(fieldNumber, value);
#pragma warning restore 0612
            }
            return(result);
        }