private void Request_AddCollectTest(Dictionary <ParameterType, object> args) { Dictionary <ReceiveMessageParam, object> response = new Dictionary <ReceiveMessageParam, object>() { { ReceiveMessageParam.CommandType, ResponseCommand.AddCollectTestResponse }, { ReceiveMessageParam.IsRequest, false }, { ReceiveMessageParam.Params, new Dictionary <ParameterType, object> { { ParameterType.responseStatus, DBManager.AddCollectTest((Test)args[ParameterType.test], (List <int>)args[ParameterType.testIDList], ProfileID) } } } }; MessageManager messageManager = new MessageManager(); byte[] bytes = messageManager.SerializeMessage(response); TcpClient.GetStream().Write(bytes, 0, bytes.Length); }