我有一段非常简单的代码用于测试代理服务器的响应,我想能够启动计时器并停止它,以获取发生这些事件所花费的时间。然而,我不认为下面的代码是我要找的。
var proxyStopWatch = new Timer();
proxyStopWatch.Start();
string[] splitProxy = ProxyList[i].Split('|');
string testResults = HTMLProcessor.HTMLProcessing.HTMLResults("http://www.google.com", splitProxy[0], Convert.ToInt32(splitProxy[1]), true, out testResults);
ProxyListResults.Add(ProxyList+"|"+proxyStopWatch.Interval.ToString());
proxyStopWatch.Stop();