My code debugs with no error however the output console( black screen) just comes like a flash and vanishes in a blink, showing nothing.
Here's my code :

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

namespace beginner
{
    class Class1
    {
        public static void Main()
        {

            Console.WriteLine("my first program");
        }
    }
}

Edited 3 Years Ago by Dani: Formatting fixed

You are probabl in debug mode.
The console will not stay on screen, so add a Console.Read or Console.ReadKey.
That way your program is waiting untill you press a key.

Not Working, I tried Console.Read/ReadKey/ReadLine();
NEither of them worked.Please help.

Well yaeh ReadKey did work only after I included
"using System.Text;
using System.Collection.Generic;
using System.Linq;"
Why did it not run with just "using System;"??

Works with me, just started a new console application project:

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Test 1 2 3");
            Console.ReadKey();
        }
    }
}

I'm using VS 2008.
BTW. under the Edit menu select IntelliSence. You got an Organise Usings option. Here you can select the Remove Unused Usings option.

This article has been dead for over six months. Start a new discussion instead.