当用户点击链接时
<a href="http://www.stackoverflow.com" target="_blank">click</a>
Run Code Online (Sandbox Code Playgroud)
有没有办法留在当前窗口而不是去标签?
当我创建一个包含方法的数组时,stopwatch.elapsedMilliseconds总是返回0.
例:
int[] methods = {method1(), method2()};
Stopwatch sw = new Stopwatch();
sw.Start();
int val = methods[1];
sw.Stop();
Console.WriteLine("It took {0} ms", sw.ElapsedMilliseconds);
// Output: "It took 0 ms"
Run Code Online (Sandbox Code Playgroud)
当我直接调用该方法时,秒表正常工作:
Stopwatch sw = new Stopwatch();
sw.Start();
method1();
sw.Stop();
Console.WriteLine("It took {0} ms", sw.ElapsedMilliseconds);
// Output: "It took x ms"
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
编辑:实际主要代码:
static void Main(string[] args)
{
Stopwatch t = new Stopwatch();
Func<int>[] problems = new Func<int>[] { problem5, problem6 };
for (int i = 0; i < problems.Length; i++)
{ …Run Code Online (Sandbox Code Playgroud)