ComputeRawMessageSetExtensionSize() public static method

Compute the number of bytes that would be needed to encode an unparsed MessageSet extension field to the stream. For historical reasons, the wire format differs from normal fields.
public static ComputeRawMessageSetExtensionSize ( int fieldNumber, ByteString value ) : int
fieldNumber int
value ByteString
return int
示例#1
0
        /// <summary>
        /// Get the number of bytes required to encode this field, incuding field number,
        /// using the MessageSet wire format.
        /// </summary>
        public int GetSerializedSizeAsMessageSetExtension(int fieldNumber)
        {
            int result = 0;

            foreach (ByteString value in lengthDelimitedList)
            {
                result += CodedOutputStream.ComputeRawMessageSetExtensionSize(fieldNumber, value);
            }
            return(result);
        }