当我返回字符串timeTaken,它是空的,它表示,这对IDE到,尽管它在主要方法被定义(时间跨度timeTaken = timer.Elapsed)问题的分配变量C#
class Program
{
public static string timeTaken;
static void Main(string[] args)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(firstline);
Stopwatch timer = new Stopwatch();
timer.Start();
using (var response = request.GetResponse());
timer.Stop();
TimeSpan timeTaken = timer.Elapsed;
...
}
}
如何输出timeTaken?
变量不是字符串.. – James
“当我返回字符串...”代码不返回任何字符串。 – 2011-08-26 08:33:34