/// <summary> /// Computes the number of bytes required to encode this field, including field /// number. /// </summary> internal int GetSerializedSize(int fieldNumber) { int result = 0; if (varintList != null) { result += CodedOutputStream.ComputeTagSize(fieldNumber) * varintList.Count; foreach (ulong value in varintList) { result += CodedOutputStream.ComputeUInt64Size(value); } } if (fixed32List != null) { result += CodedOutputStream.ComputeTagSize(fieldNumber) * fixed32List.Count; result += CodedOutputStream.ComputeFixed32Size(1) * fixed32List.Count; } if (fixed64List != null) { result += CodedOutputStream.ComputeTagSize(fieldNumber) * fixed64List.Count; result += CodedOutputStream.ComputeFixed64Size(1) * fixed64List.Count; } if (lengthDelimitedList != null) { result += CodedOutputStream.ComputeTagSize(fieldNumber) * lengthDelimitedList.Count; foreach (ByteString value in lengthDelimitedList) { result += CodedOutputStream.ComputeBytesSize(value); } } return(result); }