title: Executing the main method every 2 seconds with original input from user
body: <p>I need to make a tree in console which has moving ornaments, these ornaments need to move every 2 seconds. </p>
  
  <p>The tree is made out of X<code>s and ornaments are O</code>s, the ornaments are randomly put at different positions and different colors. </p>
  
  <p>The ornaments need to change position and color every 2 seconds.</p>
  
  <p>I need help executing the main method every two seconds with the same initial input from the user. </p>
  
  <pre><code>      X
       XXX
      XXXOO
     XXXOOXO
    XXXOOXOXO
   XOXXXOXXXOX
  XXXOOOXOOXOXX
       | |
  </code></pre>
  
  <p>Im thinking of just restarting the execution of the main method every two seconds, but when it restarts it uses the input that the user entered the first time. I just dont know how to execute a method every two seconds  </p>
  
  <pre><code>namespace ConsoleApp1
  {
      class Program
      {
          static void Main(string[] args)
          {
              Console.Write("How many levels high do you want the tree to be :");
              int input = Convert.ToInt32(Console.ReadLine());
              int treeHeight = input, Space, sX;
              Console.WriteLine("Tree:");
              for (int i = 1; i &lt;= treeHeight; i++)   //Height loop
              {
                  for (Space = 1; Space &lt;= (treeHeight - i); Space++)  //space loop
                      Console.Write(" ");
                  for (sX = 1; sX &lt;= i; sX++)         //left x loop with random ornaments
                      Console.Write(GetChar(GetRand()));
                  for (sX = (i - 1); sX &gt;= 1; sX--)     //right x loop with random ornaments
                      Console.Write(GetChar(GetRand()));
                  Console.WriteLine();
              }
              for (int k = 1; k &lt;= (treeHeight - 2); k++)
              {
                  Console.Write(" ");
              }
              Console.Write("| |");
              Console.WriteLine();
              Console.ReadLine();
          }
  
          static string GetChar(int iRandom)
          {
              string character;
              switch (iRandom)
              {
                  case 0:
                      Console.ForegroundColor = ConsoleColor.Cyan;
                      character = "O";
  
                      break;
                  case 1:
                      Console.ForegroundColor = ConsoleColor.Yellow;
                      character = "O";
                      break;
                  case 2:
                      Console.ForegroundColor = ConsoleColor.Red;
                      character = "O";
                      break;
                  case 3:
                      Console.ForegroundColor = ConsoleColor.Magenta;
                      character = "O";
                      break;
                  case 4:
                      Console.ForegroundColor = ConsoleColor.Green;
                      character = "X";
                      break;
                  case 5:
                      Console.ForegroundColor = ConsoleColor.Green;
                      character = "X";
                      break;
                  case 6:
                      Console.ForegroundColor = ConsoleColor.Green;
                      character = "X";
                      break;
                  case 7:
                      Console.ForegroundColor = ConsoleColor.Green;
                      character = "X";
                      break;
                  case 8:
                      Console.ForegroundColor = ConsoleColor.Green;
                      character = "X";
                      break;
                  case 9:
                      Console.ForegroundColor = ConsoleColor.Green;
                      character = "X";
                      break;
                  case 10:
                      Console.ForegroundColor = ConsoleColor.Green;
                      character = "X";
                      break;
                  case 11:
                      Console.ForegroundColor = ConsoleColor.Green;
                      character = "X";
                      break;
                  default:
                      Console.ForegroundColor = ConsoleColor.Green;
                      character = "X";
                      break;
              }
              return character;
          }
  
          static Int32 GetRand()
          {
  
  
              Random irandom = new Random();
              int iNum = irandom.Next(0, 11);
              return iNum;
          }
  
      }
  }
  </code></pre>