有人能告诉我在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");
}