public override ByteArray Serialize(ByteArray stream = null, bool skipHead = false) { stream = base.Serialize(stream, skipHead); if (this.hasRetCode) { WriteUtils.WriteTag(stream, WireType.Varint, 1); WriteUtils.Write_TYPE_UINT32(stream, this.retCode); } else { throw new ProtobufException("Required field retCode not set"); } return(stream); }