another interesting C# error I don't see

  • From: Katherine Moss <Katherine.Moss@xxxxxxxxxx>
  • To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 3 Jul 2011 21:40:53 +0000

Hi all,
I've got two C# errors going on here that don't seem to make sense.  In the 
first, I get the following output from the error list windows of VS 2010: "type 
or namespace definition, or end of file expected", and the second is "The name 
console does not exist in the current context".  What did I do this time?  
Thanks.

Katherine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            string comparison;
            Console.WriteLine("enter a number:");
            double var1 = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("enter another number");
            double var2 = Convert.ToDouble(console.ReadLine());
            if (var1 < var2)
                comparison = "less than";
            else
            {
                if (var1 == var2)
                comparison = "equal to";
                else
                comparison = "greater than";
            }
            Console.WriteLine(" the first number is {0} the second number.", 
comparison);
            Console.ReadKey();
        }
    }
    }
}

Other related posts: