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");
        }
    }
}

Recommended Answers

All 6 Replies

Put Console.ReadLine(); after Console.WriteLine("my first program");

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.

very simple just put
Console.readline
It will stop until u press any 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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.