linq

.NET简陋服务器

爷,独闯天下 提交于 2020-10-17 19:57:47
服务器是干啥子用滴?监听客户端,响应客户端用滴! 虽然是世界上最简陋的服务器,但是也有几个注意点: 1.因为要一个死循环监听客户端响应,也就是说无法和用户进行交互了,所以防止前台假死就要为监听新起一个线程; 2.要把新起的线程td.IsBackground = true;设置为后台线程,这样的话线程才会随着应用程序的关闭而关闭,不然的话关了窗体,它还在运行; 3.跨线程问题,在新的线程里改变UI会报跨线程改变UI的错误,所以要用Invoke; 4.在监听的死循环中加入 Thread.Sleep(1);这样可以提高应用程序性能,不要担心当服务的线程正在Sleep的时候来了个请求服务器会收不到,其实是收得到的。 加入Thread.Sleep(1)的CPU如图: 不加Thread.Sleep(1)的CPU如图: 所以一定要加! 所以服务器端代码如下: 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Windows.Forms; 9 10 using System

c# EDP_TOOL界面

╄→尐↘猪︶ㄣ 提交于 2020-10-13 06:36:11
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; using System.Threading; using System.Timers; namespace EDP_TOOL { public partial class Form1 : Form { struct PAT_ADDRESS { public string name; }; struct EDP_ADDRESS { public string name; public string HAdr; public string VAdr; public string HFP; public string HBP; public string VFP; public string VBP; public string HSYNC; public string VSYNC; public string Pixel;

C#遍历json内容,并添加到DataTable里面作为列

梦想的初衷 提交于 2020-10-12 10:30:57
C#遍历json内容,并添加到DataTable里面作为列 直接看代码,不啰嗦! 简单易懂,希望对你有帮助,若有帮助,给个赞吧! 先看json格式 {“ProdSN”:"{SerialNumber}",“EqpID”:"{EqpID}",“Parameter”:[{“ParaName”:“overallResult”,“ParaValue”:"{overallResult}"},{“ParaName”:“errCode”,“ParaValue”:"{errCode}"},{“ParaName”:“startTime”,“ParaValue”:"{startTime}"},{“ParaName”:“stopTime”,“ParaValue”:"{stopTime}"},{“ParaName”:“testerID”,“ParaValue”:"{testerID}"}]} 代码实现 需要引用:using Newtonsoft.Json.Linq; string [ ] lines = null ; string Path = System . AppDomain . CurrentDomain . BaseDirectory + "\\CONFIGURATION_TABLE" ; string strFullJosnPath = Path + "\\" + "Trackout_test