private void AddSerialPort(object messageObj) { int portId = (int)messageObj; serial_port tmpserial = new serial_port(); COMServer tmpdata = new COMServer(ParseData); tmpserial.init(tmpdata, portId); serial[portId] = tmpserial; MyData[portId] = tmpdata; Console.WriteLine("serial delegated", Environment.NewLine); }