public void Write(TWriter writer, message_id selector) { writer.WriteUnionBegin("message_body"); switch (selector) { case message_id.E_MID_LOGIN_REQ: if (writer.WriteFieldBegin("login_req")) { this._login_req.Write(writer); } writer.WriteFieldEnd("login_req"); break; case message_id.E_MID_LOGIN_RSP: if (writer.WriteFieldBegin("login_rsp")) { this._login_rsp.Write(writer); } writer.WriteFieldEnd("login_rsp"); break; default: break; } writer.WriteUnionEnd("message_body"); }