What is the best way to time how long a program runs for? I have a code and need to find out how long it will run. It seems to me that the best way - is to start a timer.
using System;
using System.Collections.Generic;
class MainClass
{
    static void Main()
    {
        var x = new {MyEnumerator = new List<int>() { 1, 2, 3 }.GetEnumerator()};
        while (x.MyEnumerator.MoveNext())
            Console.WriteLine(x.MyEnumerator.Current);
    }
}
 
     
     
    