Ejemplo n.º 1
0
        private void DoClient(TcpClient socket)
        {
            using (StreamReader sr = new StreamReader(socket.GetStream()))
            //using (StreamWriter sw = new StreamWriter(socket.GetStream()))
            {
                XmlSerializer saleSerializer = new XmlSerializer(typeof(AutoSale));
                AutoSale      sale           = (AutoSale)saleSerializer.Deserialize(sr);

                Console.WriteLine($"AutoSale as tostring {sale.ToString()}");
            }
            socket?.Close();
        }
Ejemplo n.º 2
0
        private void DoClient(TcpClient socket)
        {
            using (StreamReader sr = new StreamReader(socket.GetStream()))
            //using (StreamWriter sw = new StreamWriter(socket.GetStream()))
            {
                string   jsonLine = sr.ReadLine();
                AutoSale sale     = JsonConvert.DeserializeObject <AutoSale>(jsonLine);

                Console.WriteLine($"AutoSale as json string {jsonLine}\r\nAnd as tostring {sale.ToString()}");
            }
            socket?.Close();
        }