Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有人能告诉我在testTimer之后我需要做什么吗。开始,因为秒表仍在下划线下(Visual Studio C#) private void btnTestConcatenations\u单击(对象发送方,事件参数e) { var testTimer=新秒表(); testTimer.Start(); testTimer.Stop(); var elapsedTime=testTimer.appeased; var strTest=string.Empty; for(int loopcount=0;loopcount_C#_Winforms_Visual Studio_Timer_Stopwatch - Fatal编程技术网

有人能告诉我在testTimer之后我需要做什么吗。开始,因为秒表仍在下划线下(Visual Studio C#) private void btnTestConcatenations\u单击(对象发送方,事件参数e) { var testTimer=新秒表(); testTimer.Start(); testTimer.Stop(); var elapsedTime=testTimer.appeased; var strTest=string.Empty; for(int loopcount=0;loopcount

有人能告诉我在testTimer之后我需要做什么吗。开始,因为秒表仍在下划线下(Visual Studio C#) private void btnTestConcatenations\u单击(对象发送方,事件参数e) { var testTimer=新秒表(); testTimer.Start(); testTimer.Stop(); var elapsedTime=testTimer.appeased; var strTest=string.Empty; for(int loopcount=0;loopcount,c#,winforms,visual-studio,timer,stopwatch,C#,Winforms,Visual Studio,Timer,Stopwatch,秒表用于计时操作。由于此方法中发生的唯一其他事情是串联循环,因此可以安全地假设这就是您想要计时的内容吗 如果是这样,您可以这样做: private void btnTestConcatenations_Click(object sender, EventArgs e) { var testTimer = new Stopwatch(); testTimer.Start(); testTimer.Stop(); var elapsedTime = testTimer

秒表用于计时操作。由于此方法中发生的唯一其他事情是串联循环,因此可以安全地假设这就是您想要计时的内容吗

如果是这样,您可以这样做:

private void btnTestConcatenations_Click(object sender, EventArgs e)
{
    var testTimer = new Stopwatch();
    testTimer.Start();
    testTimer.Stop();
    var elapsedTime = testTimer.Elapsed;

    var strTest = string.Empty;

    for (int loopcount = 0; loopcount < NUMBER_CONCATENATIONS_TO_PERFORM; loopcount++)
    {
        strTest += "Adding 20 caracters";
    }

    Application.DoEvents();     
private void btnTestConcatenations\u单击(对象发送方,事件参数e)
{
var testTimer=新秒表();
var strTest=string.Empty;
var numperations=要执行的连接数;
//启动秒表
testTimer.Start();
//做一些你想测量的操作
for(int-loopcount=0;loopcount
private void btnTestConcatenations_Click(object sender, EventArgs e)
{
    var testTimer = new Stopwatch();
    var strTest = string.Empty;
    var numOperations = NUMBER_CONCATENATIONS_TO_PERFORM;

    // Start the stopwatch
    testTimer.Start();

    // Do some operation that you want to measure
    for (int loopcount = 0; loopcount < numOperations; loopcount++)
    {
        strTest += "Adding 20 characters";
    }

    // Stop the stopwatch
    testTimer.Stop();
    var elapsedTime = testTimer.Elapsed;

    // Do something with the stopwatch results
    MessageBox.Show($"It took {elapsedTime} seconds to do {numOperations} concatenations");
}