1. Home
  2. Computing & Technology
  3. C / C++ / C#

C# Tutorial - Getting Started

By David Bolton, About.com

6 of 8

How Fast can a Computer Count?

Example 1B

using System;
using System.Text;
using System.Diagnostics;

namespace System
{
    class System
    {
        private static Stopwatch stopWatch= new Stopwatch() ;

        static int Main()
        {
            Console.WriteLine("Started") ;
            stopWatch.Start() ;
            for (int Outerloop=0;Outerloop<100000;Outerloop++){
                for (ulong a =0;a < 127; a++)
                {
                    ulong b=(ulong)a;
                }
            }
            stopWatch.Stop() ;
            Console.WriteLine("Ended after "+ stopWatch.ElapsedMilliseconds.ToString() +"ms") ;
            Console.ReadKey() ;
            return 0;
        }
    }
}

On the next page : About this example.

Explore C / C++ / C#
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#
  4. C# / C Sharp
  5. Learn C Sharp
  6. How Fast can a Computer Count?

©2009 About.com, a part of The New York Times Company.

All rights reserved.