标签:ntc public style 在线 dso recv datetime idv log
// encode List<clientState> clientList = new List<clientState>(); for (int i = 0; i < 5; i++) { clientState cst = new clientState { clientConnectTime = DateTime.Now, clientRecv = 1, clienthandle = 2, clientIP = "127.0.0.1" }; clientList.Add(cst); } string sReply = JsonConvert.SerializeObject(clientList); //decode List<clientState> source1 = JsonConvert.DeserializeObject<List<clientState>>(sReply); var Dsource = new BindingSource(); Dsource.DataSource = source1; dataGridView1.DataSource = Dsource; //dataGridView1.Invoke((Action)(() => dataGridView1.DataSource = Dsource)); 如果在线程中,就这样写 ///////////////////////////////////////////////////////////////////////////////////////////////////// class clientState { public DateTime clientConnectTime { get; set; } public int clientRecv { get; set; } public int clienthandle { get; set; } public string clientIP { get; set; } }
JSON序列化,并解码成为 datagridview 的 datasource
标签:ntc public style 在线 dso recv datetime idv log
原文地址:http://www.cnblogs.com/lthxk-yl/p/6808200.html