public void Code(IByteArrayWriter writer, ref object value) { MessageBase valueEx = value as MessageBase; if (valueEx == null) { throw new NullReferenceException("转换为空"); } valueEx.PackMsg(writer); }