Link to home
Start Free TrialLog in
Avatar of Alex A
Alex A

asked on

.Net Console app: System.Console.WriteLine

Hi, there is 'using System;' in the beginning of the file.

However  Console. WriteLine doesn't compile and requires System.Console.WriteLine.
Why? How can it be fixed?

Thanks.
SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of p_davis
p_davis

is your using statement outside of the class?
Are you sure you haven't defined your own "System" namespace in your project?
Avatar of Alex A

ASKER

using System;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net.Http.Headers;



namespace AdventureWorksWeb.Console
{


    class Program
    {
        private static readonly HttpClient client = new HttpClient();
        static void Main(string[] args)
        {
            System.Console.WriteLine("Testing 2 API methods, please choose");
            System.Console.WriteLine("1. Get products");
            System.Console.WriteLine("2. Get product by id");
            string choice = System.Console.ReadLine();
            if (choice == "1")
            {
                ProcessProducts().Wait();
            }
            else
            {
                System.Console.WriteLine("Enter Product ID");
                string Id = System.Console.ReadLine();
                ProcessProduct(Id).Wait();
            }


        }

   }
}
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or just remove the .
Avatar of Alex A

ASKER

Yes, thank you!
System.Console.WriteLine should still have worked, Console.WriteLine won't
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial