Ejemplo n.º 1
0
        private void Counter(object sb)
        {
            sendParams param = sb as sendParams;

            for (int i = 0; i < 1000000; i++)
            {
                //var fhgf = 500/20;
                param.sb.Append(i.ToString());
                param.sb.Append("\r\n");
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            sendParams sendParams1 = new sendParams
            {
                sb = sb1
            };
            sendParams sendParams2 = new sendParams
            {
                sb = sb2
            };
            sendParams sendParams3 = new sendParams
            {
                sb = sb3
            };
            sendParams sendParams4 = new sendParams
            {
                sb = sb4
            };
            sendParams sendParams5 = new sendParams
            {
                sb = sb5
            };

            Counter(sendParams1);
            Counter(sendParams2);
            Counter(sendParams3);
            Counter(sendParams4);
            Counter(sendParams5);

            richTextBox1.Text += sb1 + separator;
            richTextBox1.Text += sb2 + separator;
            richTextBox1.Text += sb3 + separator;
            richTextBox1.Text += sb4 + separator;
            richTextBox1.Text += sb5 + separator;
            TimeSpan ts = stopWatch.Elapsed;

            label1.Text = ts.ToString();
        }